Using org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getManager().getQueueManager().deploy(QueueDeployment) is fine. If you want to use broker.xml just make sure it's on the classpath as previously discussed.
As for receiving and sending messages there are lots of examples of that in the examples shipped with Artemis as well as in the documentation and the test-suite. Justin ----- Original Message ----- From: "Julien d" <[email protected]> To: [email protected] Sent: Monday, May 2, 2016 4:07:00 PM Subject: Embedded REST - monitor queues (without JMS) Thank you so much for your help Justin. I now understand much better. As far as queues are concerned, I am now doing it this way in order to create one : QueueDeployment deployment1 = new QueueDeployment("orders", true); Restserver.getManager().getQueueManager().deploy(deployment1) I guess that's quite the right way to do it. What about if I want to use broker.xml ? Since in the example it was the JMS way : <jms xmlns="urn:activemq:jms"> <!--the queue used by the example--> <queue name="orders"/> </jms> And most important and very likely my last questions :) I am posting the following to http://localhost:8081/queues/orders/create : <order> <name>Bill</name> <item>iPhone 4</item> <cost>$199.99</cost> </order> 1. How can I access, internally in the program, the message that I receive upon reception? 2. How can I, still upon reception, send the following message to all subscribers of "queue2"? <state>received</state> Regards, Julien D. Alternative email address : [email protected] On 05/02/2016 06:15 PM, Justin Bertram wrote: > The login.config is a server-side configuration file for the broker's > security manager. See more at > http://activemq.apache.org/artemis/docs/1.2.0/security.html. You can put a > login.config on your classpath or you can configure it programmatically by > calling > org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ#getEmbeddedActiveMQ().setSecurityManager(ActiveMQSecurityManager) > before you start it. There are lots of examples of programmatic > configuration in the test-suite. > > > Justin > > ----- Original Message ----- > From: "Julien d" <[email protected]> > To: [email protected] > Sent: Monday, May 2, 2016 10:02:05 AM > Subject: Re: Embedded REST queried from the dupsend/PostOrder example - > Unable to validate user > > I do not have one on either side at the moment. Should it be on server > side? Would you please have any documentation link? > > Regards, > > Julien D. > > Alternative email address : [email protected] > > On 05/02/2016 05:51 PM, Justin Bertram wrote: >> How is your login.config configured? >> >> >> Justin >> >> ----- Original Message ----- >> From: "Julien d" <[email protected]> >> To: [email protected] >> Sent: Monday, May 2, 2016 4:28:27 AM >> Subject: Embedded REST queried from the dupsend/PostOrder example - Unable >> to validate user >> >> Hi, >> >> I get the following stacktrace on dup-send's side when querying the >> REST embedded server. I have been checking around and it should work >> since I have artemis-roles/users.proprieties in my Java path. >> Following are the stacktraces [1]. >> >> Anyone having the issue or would know what is actually happening? Justin? >> >> Thank you in advance and hope you had a nice May Day. >> >> Regards, >> Julien >> >> >> [1]: >> Server : >> >> May 02, 2016 12:23:43 PM >> org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser >> parseMainConfig >> WARN: AMQ222018: AIO was not located on this platform, it will fall >> back to using pure Java NIO. If your platform is Linux, install >> LibAIO to enable the AIO journal >> May 02, 2016 12:23:44 PM >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start >> INFO: AMQ221000: live Message Broker is starting with configuration >> Broker Configuration >> >> (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging) >> May 02, 2016 12:23:44 PM >> org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl >> <init> >> INFO: AMQ221043: Protocol module found: [artemis-server]. Adding >> protocol support for: CORE >> May 02, 2016 12:23:45 PM >> org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor start >> INFO: AMQ221020: Started Acceptor at localhost:61616 for protocols >> [CORE] >> May 02, 2016 12:23:45 PM >> org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation run >> INFO: AMQ221007: Server is now live >> May 02, 2016 12:23:45 PM >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl start >> INFO: AMQ221001: Apache ActiveMQ Artemis Message Broker version >> 1.3.0-SNAPSHOT [localhost, nodeID=910d0220-1047-11e6-989e-606720d89c89] >> [Mon May 02 12:23:45 EEST 2016] Servlet for path '/' already defined >> and no default will be used. >> May 02, 2016 12:23:51 PM >> org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler >> handleCreateSession >> ERROR: AMQ224018: Failed to create session >> ActiveMQSecurityException[errorType=SECURITY_EXCEPTION >> message=AMQ119031: Unable to validate user] >> at >> >> org.apache.activemq.artemis.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:145) >> at >> >> org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.createSession(ActiveMQServerImpl.java:1100) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleCreateSession(ActiveMQPacketHandler.java:151) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:77) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:628) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:368) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:350) >> at >> >> org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:606) >> at >> >> org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:189) >> at >> >> org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100) >> at >> >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) >> at >> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) >> at java.lang.Thread.run(Thread.java:745) >> >> [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet >> org.jboss.resteasy.spi.UnhandledException: >> ActiveMQSecurityException[errorType=SECURITY_EXCEPTION >> message=AMQ119031: Unable to validate user] >> at >> >> org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76) >> at >> >> org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212) >> at >> >> org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168) >> at >> >> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411) >> at >> >> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202) >> at >> >> org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221) >> at >> >> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) >> at >> >> org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40) >> at >> >> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) >> at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328) >> at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282) >> at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054) >> at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402) >> at java.lang.Thread.run(Thread.java:745) >> Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION >> message=AMQ119031: Unable to validate user] >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:404) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:305) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:291) >> at >> >> org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:239) >> at >> >> org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1309) >> at >> >> org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:674) >> at >> >> org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:337) >> at >> >> org.apache.activemq.artemis.rest.queue.QueueDestinationsResource.findQueue(QueueDestinationsResource.java:107) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> at >> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:498) >> at >> >> org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:79) >> at >> >> org.jboss.resteasy.core.ResourceLocatorInvoker.createResource(ResourceLocatorInvoker.java:58) >> at >> >> org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100) >> at >> >> org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395) >> ... 11 more >> >> [Mon May 02 12:23:51 EEST 2016] Unexpected problem running servlet: >> org.jboss.resteasy.spi.UnhandledException: >> ActiveMQSecurityException[errorType=SECURITY_EXCEPTION >> message=AMQ119031: Unable to validate user] >> [Mon May 02 12:23:52 EEST 2016] IO error: java.net.SocketException: >> Connection reset in processing a request from /127.0.0.1:8081 / >> java.net.Socket >> >> >> >> >> Client : >> >> /usr/lib/jvm/java-7-jdk/bin/java -Didea.launcher.port=7536 >> -Didea.launcher.bin.path=/usr/share/intellij-idea-ultimate-edition/bin >> -Dfile.encoding=UTF-8 -classpath >> >> /usr/lib/jvm/java-7-jdk/jre/lib/charsets.jar:/usr/lib/jvm/java-7-jdk/jre/lib/deploy.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-jdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-jdk/jre/lib/javaws.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jce.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfr.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-jdk/jre/lib/jsse.jar:/usr/lib/jvm/java-7-jdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-jdk/jre/lib/plugin.jar:/usr/lib/jvm/java-7-jdk/jre/lib/resources.jar:/usr/lib/jvm/java-7-jdk/jre/lib/rt.jar:/home/johnny/Downloads/apache-artemis-1.2.0/examples/features/standard/rest/dup-send/target/classes:/home/johnny/.m2/repository/org/apache/activemq/artemis-core-client/1.2.0/artemis-core-client-1.2.0.jar:/home/johnny/.m2/repository/org/jgroups/jgroups/3.6.6.Final/jgroups-3.6.6.Final.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-commons/1.2.0/artemis-commons-1.2.0.jar:/home/johnny/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/johnny/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/johnny/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-server/1.2.0/artemis-server-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/logging/jboss-logging/3.1.4.GA/jboss-logging-3.1.4.GA.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-selector/1.2.0/artemis-selector-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-journal/1.2.0/artemis-journal-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-native/1.2.0/artemis-native-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-client/1.2.0/artemis-jms-client-1.2.0.jar:/home/johnny/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-jms-server/1.2.0/artemis-jms-server-1.2.0.jar:/home/johnny/.m2/repository/org/apache/activemq/artemis-service-extensions/1.2.0/artemis-service-extensions-1.2.0.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-ejb_3.0_spec/1.0.1/geronimo-ejb_3.0_spec-1.0.1.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1.1/geronimo-jta_1.1_spec-1.1.1.jar:/home/johnny/.m2/repository/io/netty/netty-all/4.0.32.Final/netty-all-4.0.32.Final.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.jar:/home/johnny/.m2/repository/org/apache/activemq/rest/artemis-rest/1.2.0/artemis-rest-1.2.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jackson-provider/3.0.13.Final/resteasy-jackson-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.12/jackson-jaxrs-1.9.12.jar:/home/johnny/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.12/jackson-xc-1.9.12.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-atom-provider/3.0.13.Final/resteasy-atom-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/resteasy/tjws/3.0.13.Final/tjws-3.0.13.Final.jar:/home/johnny/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/home/johnny/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.1_spec/1.0.1/geronimo-annotation_1.1_spec-1.0.1.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/3.0.13.Final/resteasy-jaxrs-3.0.13.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/ws/rs/jboss-jaxrs-api_2.0_spec/1.0.0.Final/jboss-jaxrs-api_2.0_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/org/jboss/spec/javax/annotation/jboss-annotations-api_1.2_spec/1.0.0.Final/jboss-annotations-api_1.2_spec-1.0.0.Final.jar:/home/johnny/.m2/repository/javax/activation/activation/1.1.1/activation-1.1.1.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar:/home/johnny/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar:/home/johnny/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/johnny/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar:/home/johnny/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/home/johnny/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar:/home/johnny/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/3.0.13.Final/resteasy-jaxb-provider-3.0.13.Final.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar:/home/johnny/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar:/home/johnny/.m2/repository/javax/xml/bind/jaxb-api/2.2.7/jaxb-api-2.2.7.jar:/home/johnny/.m2/repository/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtime-2.16.jar:/home/johnny/.m2/repository/com/sun/xml/fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar:/home/johnny/.m2/repository/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar:/usr/share/intellij-idea-ultimate-edition/lib/idea_rt.jar >> com.intellij.rt.execution.application.AppMain PostOrder >> Send Bill's order... >> Exception in thread "main" java.lang.NullPointerException >> at PostOrder.main(PostOrder.java:36) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> at >> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:606) >> at >> com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) >> >> Process finished with exit code 1 >> >> Julien D. >> >> Alternative email address : [email protected] >> >> On 04/29/2016 11:26 PM, Justin Bertram wrote: >>> I recommend you put the documentation in the existing chapter on REST [1]. >>> >>> >>> Justin >>> >>> [1] >>> https://github.com/apache/activemq-artemis/blob/master/docs/user-manual/en/rest.md >>> >>> ----- Original Message ----- >>> From: "Julien d" <[email protected]> >>> To: [email protected] >>> Sent: Friday, April 29, 2016 3:12:22 PM >>> Subject: Re: Embedding REST >>> >>> Thank you Justin. >>> Where do you think it would be best to document embedding REST once I am >>> more familiar with it? >>> >>> Regards, >>> >>> Julien D. >>> >>> Alternative email address : [email protected] >>> >>> On 04/29/2016 05:59 PM, Justin Bertram wrote: >>>> You need to connect to the embedded HTTP server which, by default, >>>> listens on 8081. >>>>
