As the title states, I want to use the JMS to interact with a queue server(rabbitmq and apollo, for testing) but I read that JMS is included in Java EE. Is there a library or way I can get access to it without EE? I am just using the standard JDK that comes with mac(I don't see the EE avail for mac on the download page).
A possible option would be to use the client library which is offered by RabbitMQ (http://www.rabbitmq.com/java-client.html).
This way you can simply connect to a RabbitMQ server/queue.
But I'm not sure if this library can be used to connect to other JMS implementations than RabbitMQ.
Related
I am trying to connect my Java program to the SAP event mesh to listen on changes published to a topic/queue.
There are some limited examples on the web on how to do this, but they all use Spring.
I can't use Spring, so was wondering if anyone has some example Java code for connecting that does not use Spring. Something really simple with JMS, AMQP etc (I can add all the bells and whistles, I just need to get the connection working).
Also I need to connect using AMPQ over web sockets. Is there a nice Java library for that? Some JMS lib, Apache Camel, ..?
thanks
graham
I have a web application that has communicate with other Java web application throught JMS in Weblogic.
I read this answer:
How to connect Jms from PHP ?
I installed ActiveMQ and tried to use it.
But in the Weblogic we need "JMS_FACTORY" and "QUEUE_NAME".
I think it use t3 protocol.
When I want to use is ActiveMQ, it needs tcp protocol.
for example:
$stomp = new \Stomp('tcp://10.x.x.x:9700');
Is that possible to push messages in the Weblogic queue?
I think you mix API, wire protocol and client vs server in your question.
WebLogic JMS builds on java constructs all the way from Client to Server. If you really really need queue support I guess you need to create a PHP extension (in C/C++) that uses WebLogic C API (which in turn is a Java bridge). Maybe not smooth or bug free.
The easy way is to write a small WebLogic app that receives messages over HTTP and posts them to a queue. Or, if you can't touch the WebLogic installation, create a Standalone java app that you connect to your PHP in whatever way (HTTP, STOMP, MQTT, memory grid, files, whatever)
I need to write simple Java client for IBM MQ. What is the benefit using WebSphere MQ classes for Java (com.ibm.mq.jar) rather than using WebSphere MQ classes for JMS (jms.jar) for writing MQ client in Java?
The IBM KnowledgeCenter has a short article on this. There is no straight forward "one is better than the other" answer. The main difference between the 2 is the APIs they offer. There's a reasonable argument that you should choose which one to use based on the API you're most comfortable with.
The MQ classes for JMS client implements the JMS 1.1 specification and (for version 8.0 or later) the JMS 2.0 specification. For the most part this means you can follow non-IBM documentation regarding how to write a good JMS application. There is lots of documentation on the web about JMS so you benefit from a wide range of support from other JMS users.
The MQ classes for Java client is a proprietary IBM API for writing messaging applications that use IBM MQ. It offers an object-oriented equivalent of the procedural MQ API for C and give you access to all of the messaging features available in IBM MQ. Writing an application using the classes for Java exposes you slightly more to MQ specifics. For example to open a queue for putting messages to it you specify the CMQC.MQOO_OUTPUT option, something an MQ developer would be familiar with but a JMS developer would not be. If you're intending to learn about MQ as well as writing a quick sample application the classes for Java might well be better suited to that.
Also because the JMS classes implement an open standard they are not ideally suited to configuring or using all of MQ's proprietary features or configuration options. It is possible set MQ-specific behaviour on the JMS classes, it's just not as well suited to that as the MQ classes for Java.
If all you want is a quick sample client, MQ ships samples for both styles of application:
For the MQ classes for JMS there are samples in [mq-install-root]/samp/jms/samples (on
Unix) or [mq-install-root]/Tools/jms/samples (on Windows).
For the MQ classes for Java the samples are in
[mq-install-root]/samp/wmqjava/samples (on Unix) or
[mq-install-root]/Tools/wmqjava/samples
I'd like to use the Java Message Service but it says it's for the Java EE Platform. Is there a way to port it to a regular Java application (which I'm working on in Eclipse)?
JMS is part of the Java EE spec, but you can use it from any Java application. Depending on your needs, you may have to run a standalone broker, but this is just like running a regular daemon (or Windows service).
Yes, you absolutely can use JMS from a J2SE application. In fact, you can access a JMS broker from programs not written in Java at all. The ActiveMQ JMS server includes several transport connectors. The connectors allow clients to interact with ActiveMQ using different communication protocols. Most Java clients use the openwire connector. I've written a PHP client that used the STOMP protocol with great success. It consumed messages sent to a JMS Queue by a Java application running in the Tomcat Servlet Container.
This is a much more complicated question than the answer would indicate. Jms is a spec. Really just a set of interfaces. You can absolutley use those interfaces from a standalone java process. Hell you could write your own jms compliant messaging implementation. Questions you should be asking yourself is what messaging implementation will i be using and does it support jms? Even after answering that there are numerous caveats to take into account when connecting to brokers outside of a container including but not limited to transactionality, load balancing, connection pooling, and high availability. You should be very clear about what your trying to do and what messaging vendor you are working with before you can answer this completely
Many Messaging servers also provides their java api for the communication like MQ, open source Apache ActiveMQ. In that case you don't realy need to worry about JMS. You simply need to understand and use that API.
For some integration projects I would like to query JMX agents from non-Java clients.
I found two options so far, ws-jmx-connector (Soap based) and mx4j and its JMX HTTP adaptor which returns XML document responses. The JSR 262 based ws-jmx-connector seems to be no longer in active development. I have not tried MX4J so I do not know if it is possible to use the HTTP adaptor with the standard JMX implementation in the J2SE.
Are there other software projects which can help to connect non-Java clients with JMX agents, using open standard protocols?
Update: meanwhile I found this project, a "Restful JMX Adaptor". It is also described in the article RESTful Access to JMX Instrumentation, Via URI-fication of MBean Attributes
I recommend Jolokia, which is a full featured JSON/HTTP adapter for JMX. It has several client libs, i.e. jmx4perl, which allows for programatic JMX access from within perl. For Java and Javascript there are client bindings, too. More are in the pipeline (Scala, Groovy, Python). The installation is dead easy, for a Java EE container it is as simple as deploying a standard Java EE war. Other agents (OSGi, Mule, JVM6) are available, too.
Jolokia is a agent based and implies that I install a server and agents. What I am after is a lightweight pure command line, non-java based, non-agent based solution to call JMX/RMI interface.
Let it be a C-code application or perl or python whatever as long as it is fast.