Guide - What is an Application Listener?

Introduction

This is very similar to BlockListener in that it is notified during lifecycle of blocks and application. In Java terms the ApplicationListener interface extends BlockListener so it is always informed of both types of events.

Events notified

ApplicationListener components are created before any Blocks are created in an Application. They receive notifications before and after the Application is started and stopped.

How to make a block listener

Like normal blocks, an application listener can be LogEnabled and take configuration via Configurable. The special feature is that it must implement ApplicationListener and implement the four methods that are a consequence of that (as well as four from BlockListener). The following section in assembly.xml causes instantiation of the application listener. It is exactly the same as that for BlockListener:

        <listener class="pkg.MyApplicationListener" name="a-suitable-name" />
      

Guide Contents

  1. What is a block?
  2. What is a block listener?
  3. What is an application listener?
  4. How do I create a block?
  5. How do I make my components phoenix-compatible?
  6. BlockInfo specification
by Paul Hammant