Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. package main;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import javax.ejb.ActivationConfigProperty;
  6. import javax.ejb.MessageDriven;
  7. import javax.jms.JMSException;
  8. import javax.jms.Message;
  9. import javax.jms.MessageListener;
  10. import javax.jms.TextMessage;
  11.  
  12.  
  13. /**
  14.  * Message-Driven Bean implementation class for: Bolid
  15.  */
  16. @MessageDriven(
  17.         activationConfig = { @ActivationConfigProperty(
  18.                 propertyName = "destination", propertyValue = "java:/jms/queue/SRIQueue"), @ActivationConfigProperty(
  19.                 propertyName = "destinationType", propertyValue = "javax.jms.Queue")
  20.         },
  21.         mappedName = "java:/jms/queue/SRIQueue")
  22. public class Bolid implements MessageListener {
  23.  
  24.     private static Logger LOGGER = Logger.getLogger(Bolid.class.getName());
  25.     /**
  26.      * Default constructor.
  27.      */
  28.     public Bolid() {
  29.         // TODO Auto-generated constructor stub
  30.         LOGGER.info("Created");
  31.     }
  32.    
  33.     /**
  34.      * @see MessageListener#onMessage(Message)
  35.      */
  36.     public void onMessage(Message message) {
  37.         // TODO Auto-generated method stub
  38.         if(message instanceof TextMessage) {
  39.             TextMessage textMessage = (TextMessage) message;
  40.             try {
  41.                 LOGGER.info(textMessage.getText());
  42.             } catch (JMSException e) {
  43.                 // TODO Auto-generated catch block
  44.                 e.printStackTrace();
  45.             }
  46.         }
  47.     }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement