You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Martin Ritchie (JIRA)" <qp...@incubator.apache.org> on 2007/01/23 23:29:49 UTC

[jira] Assigned: (QPID-103) Implement support for MessageListener interface

     [ https://issues.apache.org/jira/browse/QPID-103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Ritchie reassigned QPID-103:
-----------------------------------

    Assignee: Martin Ritchie  (was: Tejeswar Das)

> Implement support for MessageListener interface
> -----------------------------------------------
>
>                 Key: QPID-103
>                 URL: https://issues.apache.org/jira/browse/QPID-103
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>            Reporter: Marnie McCormack
>         Assigned To: Martin Ritchie
>             Fix For: M2
>
>
> See AMQSession.get/setMessageListener methods which currently throw UnsupportedOperationException.
> See javadoc/JMS spec.
> The snippet below talks a little about the MessageListener interface (from JMS specification):
> 9.3.1 Receiving Messages Asynchronously
> In order to receive message asynchronously as they are delivered to the message consumer, the client program needs to create a message listener that implements the MessageListener interface. An implementation of the MessageListener interface, called StockListener.java, might look like this:
> import javax.jms.*;
> public class StockListener implements MessageListener
> {
> public void onMessage(Message message) {
> /* Unpack and handle the messages received */
> ...
> }
> }
> The client program registers the MessageListener object with the MessageConsumer object in the following way:
> StockListener myListener = new StockListener();
> /* Receiver is MessageConsumer object */
> receiver.setMessageListener(myListener);
> The Connection must be started for the message delivery to begin. The MessageListener is asynchronously notified whenever a message has been published to the Queue. This is done via the onMessage method in the MessageListener interface. It is up to the client to process the message there.
> JMS Example Code?April 12, 2002 105
> 9
> public void onMessage(Message message)
> {
> String newStockData;
> /* Unpack and handle the messages received */
> newStockData = message.getText();
> if(...)
> {
> /* Logic related to the data */
> }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.