java - use message driven bean to get message from topic apache apollo -


i create java app uses message driven bean(mdb) message topic apache apollo through resource adapter activemq 5.10 in glassfish. when use apache activemq, works fine not work apache apollo. use mqtt send message topic , mqtt listen @ topic , gets message. when use mdb listen , can't message. see apollo console, tab virtual host -> topic. click topic use send , receive message. topic has consumer , producer, "enqueued: 2 items / 2.72 kb" consumer "transfers = 0". don't know how mdb work apollo.

apollo.xml

<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">   <notes>        default configuration tls/ssl enabled.   </notes>   <log_category console="console" `enter code here`security="security"connection="connection"audit="audit"/>   <authentication domain="apollo"/>   <!-- give admins full access -->   <access_rule allow="admins" action="*"/>   <access_rule allow="*" action="*"/>    <virtual_host id="benchmark-broker">      <host_name>benchmark-broker</host_name>      <host_name>localhost</host_name>      <host_name>127.0.0.1</host_name>       <authentication enabled="false"/>      <topic slow_consumer_policy="block" >        <subscription tail_buffer="4k"/>      </topic>   </virtual_host>   <web_admin bind="http://0.0.0.0:9022"/>   <web_admin bind="https://127.0.0.1:61681"/>   <connector id="tcpmqtt" bind="tcp://0.0.0.0:7521" connection_limit="60000">       <mqtt max_message_length="104857600"  />   </connector>  <connector id="tcpopenwire" bind="tcp://0.0.0.0:9021" connection_limit="60000">      <openwire tight_encoding="false" tcp_no_delay="true"/>  </connector> </broker> 

code publish message:

    string user = env("apollo_user", "admin");     string password = env("apollo_password", "password");     string host = env("apollo_host", "192.168.0.54");     int port = integer.parseint(env("apollo_port", "7521"));     final string destination = arg(args, 0, "cuongdm17");     int messages = 1;     string body = "test";      mqtt mqtt = new mqtt();     mqtt.sethost(host, port);     mqtt.setusername(user);     mqtt.setpassword(password);      futureconnection connection = mqtt.futureconnection();     connection.connect().await();     final linkedlist<future<void>> queue = new linkedlist<future<void>>();     utf8buffer topic = new utf8buffer(destination);     (int = 1; <= messages; i++) {         queue.add(connection.publish(topic, msg, qos.at_least_once, false));     } 

mdb :

@messagedriven(activationconfig = { @activationconfigproperty(propertyname = "acknowledgemode", propertyvalue = "auto-acknowledge"), @activationconfigproperty(propertyname = "destinationtype", propertyvalue = "javax.jms.topic"), @activationconfigproperty(propertyname = "destination", propertyvalue = "cuongdm17") }) public class cuongdm17 extends amiabstractmqttprocessor implements messagelistener, serializable {  static final logger logger = logger.getlogger(amimonitorprocessor.class.getname());  public cuongdm17() { }  @override protected logger getlogger() {     return logger; }  /**  * handler mqtt (already transcript jms) messages dcu device  *  * @param message  */ @override public void onmessage(message message) {     try {         info("cuongdm17");     } catch (exception e) {         error("error when processing onmessage, error message=" + e.getmessage() + ", message trace=" + message, e);     } }  @override protected void receivemessage(mqttpayloaddata payload) throws exception {     info("cuongdm17"); }  @override public string tostring() {     return "current-info processor"; } } 

even if apollo has great modern core, not have features of activemq. while activemq supports mixing wire protocols between producers/consumers - apollo not. if switch apollo, switch consuming using mqtt in case.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -