@MessageDriven(name = "VertxMonitor", messageListenerInterface = VertxListener.class, activationConfig = { @ActivationConfigProperty(propertyName = "address", propertyValue = "inbound-address"), }) public class VertxMonitor implements VertxListener {
/** * <p>MessageDrivenBean implementation of the {@link JobExecutionHandler} interface</p> * * @author Daniel Meyer */ @MessageDriven( name="JobExecutionHandlerMDB", messageListenerInterface=JobExecutionHandler.class ) @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class JobExecutionHandlerMDB implements JobExecutionHandler { public void executeJob(String job, CommandExecutor commandExecutor) { ExecuteJobHelper.executeJob(job, commandExecutor); } }
/** * @author Antonio Goncalves * APress Book - Beginning Java EE 7 with Glassfish 4 * http://www.apress.com/ * http://www.antoniogoncalves.org * -- */ @MessageDriven(mappedName = "jms/javaee7/Topic") public class BillingMDB09 implements MessageListener { // ====================================== // = Public Methods = // ====================================== public void onMessage(Message message) { try { System.out.println("Message received: " + message.getBody(String.class)); } catch (JMSException e) { e.printStackTrace(); } } }
@MessageDriven(name = "SystemProperties") public class SystemPropertiesBean implements CrestListener { @Command public String home() { return System.getProperty("user.home"); } @Command public String home(@Exists @Directory File file) { return System.setProperty("user.home", file.getAbsolutePath()); } @Command public String dir() { return System.getProperty("user.dir"); } @Command public String dir(@Exists @Directory File file) { return System.setProperty("user.dir", file.getAbsolutePath()); } }
@MessageDriven(mappedName = "jms/greeter") public class GreeterListener implements MessageListener { @Inject private MessageHandler handler; @Override public void onMessage(Message msg) { handler.handleMessage(msg); } }
@MessageDriven(name = "User") public class UserBean implements CrestListener { @Resource private MessageDrivenContext context; @Command public String whoami() { return context.getCallerPrincipal() == null ? "Unknown" : context.getCallerPrincipal().getName(); } }
@Production @MessageDriven class Leopard /*implements MessageListener*/ { public void onMessage(/*Message message*/) { // TODO Auto-generated method stub } }
/** * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a> */ @MessageDriven(messageListenerInterface = PostmanPat.class) @ResourceAdapter("ejb3-rar.rar") public class PostmanPatMDB implements PostmanPat { @Override public void deliver(String message) { System.out.println("Got message " + message); } }
/** * * @author Steve Millidge (Payara Foundation) */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "topicFilter", propertyValue = "test") }) public class MQTTReceiveMessage implements MQTTListener { @OnMQTTMessage public void messageArrived(String topic, MqttMessage message) { Logger.getAnonymousLogger().info("Received message on topic " + topic + " " + new String(message.getPayload())); } }
/** * * @author Steve Millidge (Payara Foundation) */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "topicFilter", propertyValue = "test") }) public class MQTTMDB implements MQTTListener { @OnMQTTMessage public void messageArrived(String topic, MqttMessage message) { System.out.println("Received message on topic " + topic + " " + new String(message.getPayload())); } }
/** * <p>MessageDrivenBean implementation of the {@link JobExecutionHandler} interface</p> * * @author Daniel Meyer */ @MessageDriven( name="JobExecutionHandlerMDB", messageListenerInterface=JobExecutionHandler.class ) @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class JobExecutionHandlerMDB implements JobExecutionHandler { public void executeJob(String job, CommandExecutor commandExecutor) { commandExecutor.execute(new ExecuteJobsCmd(job)); } }
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "OrderQueue") }) public class OrderRecvMDB implements MessageListener { /* * Process a message. * * @param message The message to process. */ public void onMessage(Message message) { TextMessage textMessage = (TextMessage) message; try { System.out.println("(mdb) Order Received \n" + textMessage.getText()); } catch (JMSException e) { e.printStackTrace(); } } }
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/test")}) public class ExampleMDB implements MessageListener { @Override public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("----------------"); System.out.println("Received: " + ((TextMessage) message).getText()); System.out.println("----------------"); } catch (JMSException e) { e.printStackTrace(); } } else { System.out.println("----------------"); System.out.println("Received: " + message); System.out.println("----------------"); } } }
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/test")}) public class ExampleQueueMDB implements MessageListener { @Override public void onMessage(Message message) { if (message instanceof TextMessage) { try { System.out.println("----------------"); System.out.println("Received: " + ((TextMessage) message).getText()); System.out.println("----------------"); } catch (JMSException e) { e.printStackTrace(); } } else { System.out.println("----------------"); System.out.println("Received: " + message); System.out.println("----------------"); } } }
@MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty( propertyName = "destination", propertyValue = "exampleTopic") }) @Interceptors(TraceeMessageListener.class) public class MessageTopicListener implements MessageListener { private static final Logger LOG = LoggerFactory.getLogger(MessageTopicListener.class); @Override public void onMessage(Message message) { LOG.info("I just received the message \"{}\" on jms/exampleTopic", message); } }
@MessageDriven(activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty( propertyName = "destination", propertyValue = "exampleQueue") }) @Interceptors(TraceeMessageListener.class) public class MessageQueueListener implements MessageListener { private static final Logger LOG = LoggerFactory.getLogger(MessageQueueListener.class); @Override public void onMessage(Message message) { LOG.info("I just received the message \"{}\" on jms/exampleQueue", message); } }
@MessageDriven(name = "testmdb", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "TESTQ"), @ActivationConfigProperty(propertyName = "resourceAdapter", propertyValue = "activemq-rar-5.14.5") }) public class ReceiveMessage implements MessageListener { public ReceiveMessage() { } @Override public void onMessage(Message message) { System.out.println("Got message " + message); } }
/** * * @author Mike Croft */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "jms/notifierQueue"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "notifierQueue"), }) public class NotificationConsumer implements MessageListener { @Override public void onMessage(Message message) { try { System.out.println("Message received: " + message.getBody(String.class)); } catch (JMSException ex) { Logger.getLogger(NotificationConsumer.class.getName()).log(Level.SEVERE, null, ex); } } }
/** * * @author Steve Millidge (Payara Foundation) */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "nameSpace", propertyValue = "${ENV=nameSpace}"), @ActivationConfigProperty(propertyName = "sasKeyName", propertyValue = "RootManageSharedAccessKey"), @ActivationConfigProperty(propertyName = "sasKey", propertyValue = "${ENV=sasKey}"), @ActivationConfigProperty(propertyName = "queueName", propertyValue = "testq") }) public class AzureSBMDB implements AzureSBListener { @OnAzureSBMessage public void receiveMessage(IMessage message) { System.out.println("Received Message " + new String(message.getBody())); } }
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = RegistrationMdb.DESTINATION_QUEUE) }) public class RegistrationMdb extends AbstractJMSHibernateSearchController implements MessageListener { public static final String DESTINATION_QUEUE = "jms/queue/hsearch"; @PersistenceUnit private EntityManagerFactory emf; @Override protected SearchIntegrator getSearchIntegrator() { return SearchIntegratorHelper.extractFromEntityManagerFactory( emf ); } }