What do I need to realize notification using JMS? - java

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.

Related

WildFly 11 ActiveMQ Web Console

I am quite new to JMS. I know that WildFly 11 has a activeMQ JMS built inside it and we can certainly add a new ActiveMQ to it. But is there a way to get a web console for the inbuilt ActiveMQ, or is there a way inwhich we can monitor the JMS Queues and Topics like in a standalone ActiveMQ instance.
Thanks in advance.
PS:
Long story short, need to get a GUI interface that can intercept and show JMS messages.
Wildfly has a web console of its own which may suit your needs. It shows basic queue metrics like consumer count, message count, messages added, and scheduled count.
If you want a console that goes beyond that you might be able to deploy the console shipped with ActiveMQ Artemis to Wildfly (e.g. by copying the war files). However, I've not done this before so I don't know how well it would work.
Another option would be to deploy ActiveMQ Artemis standalone and use that instead of the instance of ActiveMQ Artemis embedded into Wildfly. This would give you easy, simple access to the web console shipped with ActiveMQ Artemis.

Interest of using activeMQ resource adapter

I am creating a Java application in eclipse to let different devices communicate together using a publish/subscribe protocol.
I am using Jboss and ActiveMQ and I want to know if I should use an ActiveMQ resource adapter to integrate the broker in jboss in a standalone mode or I should just add dependencies in my pom.xml file and use explicit java code like indicated here http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html.
Here the documentation I found to integrate ActiveMQ within jboss in a standalone mode https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_A-MQ/6.1/html/Integrating_with_JBoss_Enterprise_Application_Platform/DeployRar-InstallRar.html
Could someone tell me what is the difference between the two approaches?
Here is the answer for my question:
The first approach starts a broker within your webapp itself. You can use a
normal consumer (not a message-driven bean - MDB), but only your webapp can
access it, via the VM transport (vm://).
The second approach lets the app server manage both the connection to the
broker and the creation of the broker, so it's probably also within the JVM
that runs your webapp and probably only accessible to your webapp, but
those details are hidden from you by the app server. You can only consume
messages via an MDB, but this provides a uniform interface that doesn't
need to change if you switch to another JMS provider in the future.
Since the standard way to integrate a JEE webapp with a JMS broker is via
the RA, I'd recommend using that approach simply for consistency and
standardization. That should also allow you to switch to a standalone
ActiveMQ broker (or another JMS product) in the future with minimal effort.

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.

Does Java Messaging Service (JMS) has a look alike or same structure on PHP?

Is there a look a like structure of JMS on PHP which can be implemented? JMS can run only on ApacheMq which I have developed a system on PHP that runs on Apache which if I run both only one is running. I dont have to have another server to run JMS? Is there look alike which can be run to Apache?
Thanks in advance.
AFAIK, JMS only runs on Java or a native compiled version e.g. Tibco EMS. These servers have clients for a wide range of languages and you shouldn't need to know what language the server uses for its implementation.
You could build a PHP version of JMS. But I would be surprised if one exists.
BTW ActiveMQ is not the only JMS server, there are many others. http://en.wikipedia.org/wiki/Java_Message_Service#Provider_implementations

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.

Categories

Resources