Run OpenJMS server as an embedded application - java

I have an application that needs to also be the JMS server (broker). So I would like to start within the same JVM the OpenJMS server. I have loosely read that this is possible, but I could not find any examples or explanation on the http://openjms.sourceforge.net site or anywhere else for that matter.
Has anyone done this, how simple is it? I know with HornetQ it is very simple but we want to remain with OpenJMS.
Thanks

Yes in HornetQ you could start an embedded jms server with only two line of code and a configuration xml.
Being that HornetQ is POJO based and opensource, why don't you choose it?
Piero.
You could also check more details on embedding HornetQ in the new HornetQ book
www.amazon.com/dp/1849518408/?tag=packtpubli-20

Related

MQTT Broker in application?

I've been using mosquitto for several months now, but now I've got to the point that I'd like to build a standalone broker into my Java application. Is it possible to do this, or would I need to have to have mosquitto running by itself on a server?
You may be able to create a JNI wrapper around mosquitto, but you may do better looking at one of the other broker implementations, specifically one already written in java.
There are several listed on the mqtt.org server wiki page.
https://github.com/mqtt/mqtt.github.io/wiki/servers
e.g. Moquette, HiveMQ or ActiveMQ

Monitoring an FTP server folder with JBoss?

I have Java application running on JBoss AS7 standalone. The application needs to monitor an FTP folder and pick up new files.
I'm aware of using commons-net FTPClient to connect to an FTP server, but I'm curious, is there a way to do this in the 'Enterprise Java' world? For instance, configuring an FTP server as a 'datasource' in JBoss, in a similar way to databases?
From googling, I've found things such as JBoss ESB that can be used with JBoss AS, and for which you can configure an 'FTP listener' to monitor for files - is this the way forward? (don't currently have JBoss ESB installed)
I've also come across the notion of using JCA, such as 'Oracle jca adapter for files/ftp', which mentions being compatible with JBoss, but there seems to be little info online about it. another is 'jca-for-ssh' but appears to only support outbound connections.
Am I going about this right way/googling for the right thing? Any pointers in the right direction are much appreciated. thanks
There are two ways to do it.
One would use the Java 7 FileWatcher. This would be an efficient, event-based solution.
Another would have a Timer task that would wake up periodically, check the directory for files, process them, and then go back to sleep.
JBoss would not be my first thought, but it's possible to incorporate either one into an object of some kind and deploy on JBoss.

Can I inspect a JBoss JMS Queue?

I'm debugging an issue I've had with messages posted to a JMS Queue within JBoss 4.2.3. I know I can see the number of messages currently on the queue via the JMX-Console, but want to know if there's a way to get anymore information about the specific messages on the queue currently?
Is any of this available via JMX or can I enable any extra logging?
Or do I have to deploy something using a QueueBrowser?
Thanks,
You could use hermes jms, which is a JMS management console with a GUI. I haven't tried it with jboss (only with glassfish), but it was working pretty well and I was able to access the individual messages in the queue. Looks like they have a tutorial for jboss here: http://www.hermesjms.com/confluence/display/HJMS/JBoss+Tutorial

Does EE Server need to be installed to make a use of JMS?

I got a question about usage of JMS(Java Message Queue). Somewhere in documentation I have seen that everything I need to use JMS is jms.jar on the machine where the client is going to run. But I still not sure if I need glassfish or JBoss also installed on machine.. Anyone can me tell if it's really only jms.jar is needed or I need something more installed on machine?
Thanks,
Serhiy.
You need jms.jar to access JMS topics and queues. But in order to have a working JMS setup you need a JMS provider. Applications servers have JMS providers bundled. There are stand-alone JMS providers, like Apache ActiveMQ or HornetQ:
you need the jms provider jar(s) on your classpath, so that its concrete classes get instantiated (The JMS API only defines the contract)
you need the jms provider running and handling incoming and outgoing messages.
Well, actually JMS is just an standard API for messaging. You'll have to use an existing implementation as well as a provider in order to use it.
If you're using JBOSS take a look at HornetQ
There's a tutorial on developerWorks which you may be interested in that describes how to run a JMS program outside of a Java EE environment using WebSphere MQ.
The question of whether you need something other than the JMS jar file is another matter. The best answer is to always use the install media supplied by the vendor. I don't know about JBoss but with IBM's implementation that install media includes diagnostic utilities and if you just grab the jar files it may not be supported. Other vendors may also have support issues if you just grab the jar files but I don't have specifics.

What do I need to realize notification using JMS?

I just need notification system. javax.jms.* - good solution I think, but I can't understand what do I need to use JMS?
I don't want to use any app. servers like GlassFish or Tomcat, I just would like to use standard jdk and myserver(very light) and myclient(very light too) and some MessageSystem to exchanging bitween myserver and myclient. As I understand to use JMS I need JMS Provider. For example: ActiveMQ. But I don't uderstand ActiveMQ needs any server?(GlassFish probably), and what kind of *.jar do I need from Java EE ?
JMS provider or more correctly a Message Broker can be a stand-alone application. Most of J2EE app servers include a broker inside them but yes we also have many very good stand alone JMS brokers, ActiveMQ is good, then there is OpenJMS and many others. And as they are stand alone they don't need another app server to run them. And they usually come with every needed jar as well :) SO you'll not need to copy any jar from other app-server to say ActiveMQ or OpenJMS.
ActiveMQ runs as a standalone server; it requires the Java VM like any Java application but nothing else beyond that.
Other stand alone JMS brokers (open source) which can be run standalone or even embedded in your Java application are Open Message Queue (OpenMQ) which is also included in GlassFish, and the new JBoss HornetQ message broker which will be the JMS implementation in JBoss application server.

Categories

Resources