Advertisement
Guest User

Untitled

a guest
Dec 15th, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. @MessageDriven(
  2.         activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic") },
  3.         mappedName = "jms/MyTopic")
  4. public class MessageListener implements javax.jms.MessageListener {
  5.  
  6.     public MessageListener() {
  7.     }
  8.    
  9.     /**
  10.      * @see MessageListener#onMessage(Message)
  11.      */
  12.     public void onMessage(Message message) {
  13.         if(message instanceof TextMessage){
  14.             try{
  15.                 String text = ((TextMessage)message).getText();
  16.                 System.out.println("Message is: " + text);
  17.             }catch(Exception e){
  18.                 e.printStackTrace();
  19.             }
  20.         }
  21.        
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement