If you want to create subtopic with Richfaces 4 JMS push notifications, you must set a specific parameter in the message that you are sending. Specifically, suppose that you have a JMS session object (in my example I obtain it using an injection of the Seam 3 JMS module). For example, create message in this way:
@Inject @JmsSession(transacted = false, acknowledgementMode = Session.CLIENT_ACKNOWLEDGE) private Session session; ...... ObjectMessage message = session.createObjectMessage(notification.getNotificationObject());
Now, set string property into JMS message to define subtopic:
message.setStringProperty("rf_push_subtopic", "subTopic");
The first parameter of the setStringProperty method is a constant that Richfaces uses to get subtopic part of the JMS address. The second parameter is the subtopic address out-and-out.
Then, you can consume notification with <a4j:push> in the same way as you use TopicsContext or CDI implementation:
<a4j:push address="subtopic@topic" ondataavailable="alert(event.rf.data)"></a4j:push>
Comments