jms - Cannot create ActiveMQ queue or send a message using java -
i'm new activemq. i'm running activemq server on windows using default settings on local machine. i've tried create simple queue test sending message.
public class foo { public static void main(string[] args) { new foo().send(); } public void send(){ try { activemqconnectionfactory connectionfactory = new activemqconnectionfactory("vm://localhost:61616"); connection connection = connectionfactory.createconnection(); connection.start(); session session = connection.createsession(false, session.auto_acknowledge); destination destination = session.createqueue("testqueue"); messageproducer producer = session.createproducer(destination); producer.setdeliverymode(deliverymode.non_persistent); textmessage message = session.createtextmessage("message123"); producer.send(message); session.close(); connection.close(); } catch (jmsexception ex) { logger.getlogger(foo.class.getname()).log(level.severe, null, ex); } } }
this code doesn't seem when try check logging on activemq admin page , check queue. (localhost:8161/admin/queues.jsp) queue not created. tried creating queue manually admin page , message not sent queue though queue created.
when test server using commands activemq producer
, activemq consumer
queue created , messages passed queue , read queue. i'm there nothing wrong server.
when run code terminal output
warn | memory usage broker (1024mb) more maximum available jvm: 887 mb - resetting 70% of maximum available: 621 mb info | using persistence adapter: kahadbpersistenceadapter[c:\users\prashan\desktop\test\activemq-data\localhost\kahadb] info | jmx consoles can connect service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi info | kahadb version 6 info | recovering journal @1:3712 info | recovery replayed 1 operations journal in 0.01 seconds. info | pliststore:[c:\users\prashan\desktop\test\activemq-data\localhost\tmp_storage] started info | apache activemq 5.13.2 (localhost, id:capsule-5179-1461559222267-0:1) starting info | apache activemq 5.13.2 (localhost, id:capsule-5179-1461559222267-0:1) started info | or more information please see: http://activemq.apache.org warn | store limit 102400 mb (current store usage 0 mb). data directory: c:\users\prashan\desktop\test\activemq-data\localhost\kahadb has 6947 mb of usable space. - resetting maximum available disk space: 6947 mb warn | temporary store limit 51200 mb (current store usage 0 mb). data directory: c:\users\prashan\desktop\test\activemq-data\localhost\tmp_storage has 6947 mb of usable space. - resetting maximum available disk space: 6947 mb info | connector vm://localhost started info | connector vm://localhost stopped info | apache activemq 5.13.2 (localhost, id:capsule-5179-1461559222267-0:1) shutting down info | pliststore:[c:\users\prashan\desktop\test\activemq-data\localhost\tmp_storage] stopped info | stopping async queue tasks info | stopping async topic tasks info | stopped kahadb info | apache activemq 5.13.2 (localhost, id:capsule-5179-1461559222267-0:1) uptime 1.918 seconds info | apache activemq 5.13.2 (localhost, id:capsule-5179-1461559222267-0:1) shutdown
you creating embedded broker , message sent there. should connect local machine broker by: tcp://localhost:61616"
rather vm://...
.
Comments
Post a Comment