Handling Notification in HelloWorld

The Hornet queue is used to provide notification support in the HelloWorld application. The destination name is given in the form of a topic name which is also configured in hornetq-jms.xml. The respective data objects should also be marked with the @jpa annotation with the same topic name. The code snippet is shown below:

....
@JmpNotification(destination = "topic/HelloWorldDatabaseChange")
@XmlAccessorType(XmlAccessType.NONE)
public class Country extends AbstractManagedObject implements Serializable {...}

 

....

@MessageDriven(name = "HelloWorldGuiNotificationMDB",
activationConfig = {	        @ActivationConfigProperty(propertyName="destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName="destination", propertyValue = "topic/HelloWorldDatabaseChange" ......})

   public class HelloWorldGuiNotificationMDB extends  GuiNotificationMDBean{                        

      public void internalOnMessage(Message message) { ........} }

 

<!--hornetq-jms.xml-->

<configuration xmlns="urn:hornetq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
...........
   <topic name="HelloWorldDatabaseChange">
       <entry name="topic/HelloWorldDatabaseChange"/>
   </topic>
.............
</configuration>