I need to write a Message Driven Bean. I'm using JBoss IDE 1.5. I understand the concept behind MDB's but I don't really know how to install the JMS provider (JBoss MQ? I think) and use it so that it will be used to broker my message to an MDB.
does anyone know of a tutorial I can use ?
JBossMQ is the default JMS provider in JBoss 3.2.x and 4.x but is replaced by JBoss Messaging1 in JBoss AS 5.0 (JBoss Messaging 1.x is the default JMS provider in JBoss AS version 5).
Depending on the version of JBoss you are using, you already have a JMS provider so I'm not sure what you want to install. And for the configuration part (e.g. how to create a Queue/Topic to which you could send messages), you have to provide some XML files.
Check the Configuration section of http://www.jboss.org/community/wiki/jbossmq and especially the Destinations page for JBossMQ. This blog post might help too.
Check the chapter 6.6 Configuring Destinations of the Jboss Messaging 1.4 user guide. This blog post might help.
Note that starting with JBoss AS version 5.1.0, there is an admin console that allows to create JMS Destinations (expand the "JMS Destinations" entry in the tree view, click on either Queues or Topics, and the in the right panel click the "Add a new resource" button) and/or Connection Factories.
1Starting from version 2.0, JBoss Messaging has been rebranded to HornetQ.
Related
I have an application deployed in Websphere which should push a message in a queue implemented in JBoss using HornetQ. That message will then be consumed by an MDB within another application (on JBoss). Is that even possible?
In summary:
WAS (producer) -> JBoss (consumer)
I think yes because the protocol JMS is shared, but what are the details? should I load JBoss with MQ libraries or is it all in the way I refer to the JBoss queue from WAS?
Thank you so much.
If the MDB deployed on JBoss EAP is receiving a message from a local queue in HornetQ, then you do not need to deploy any MQ jars.
All you will need to do is write a MDB application and read the messages in your onMessage(Message msg) method. It should be really as simple as that.
You can see an example of a MDB in the jboss eap quick start . The HelloWorldQueueMDB.java class is the one you might be interested in. Follow the code in that class and modify the destination annotation value for your particular HornetQ queue name (from standalone-full.xml or standalone-full-ha.xml or the full or full-ha profile in your domain.xml file).
On a side note, JBoss EAP 6.1 is quite old. I would highly recommend upgrading to JBoss EAP 6.4.13 or later.
Thanks to Maarten I was able to get basic ActiveMQ JMS topics and connection factories working in WAS. He has a nice write up in his reply to this topic: ActiveMQ 5.11 with WebSphere Application Server 8.5
But I cannot find a way to define any ActiveMQ JMS Activation Specs in the WAS admin console. And of course I need those in order to trigger my MDBs. ActiveMQ simply doesn't show up as a JMS provider when creating a new AS.
How do I configure Activation Specs in WAS using ActiveMQ as the provider? Am I missing a jar file?
activemq-client-5.11.0.jar
hawtbuf-1.11.jar
slf4j-api-1.7.10.jar
If you want to use Activation specification, you need to install ActiveMQ as JCA 1.5 compliant resource adapter. As far as I know, ActiveMQ provides resource adapter as separate install.
See also:
Deploying the ActiveMQ Resource Adapter into IBM WebSphere
Managing messaging with a third-party JCA 1.5 or 1.6-compliant messaging provider
ActiveMQ resource adapter
Listener ports are stabilized, and should only be used if provider doesn't support JCA.
Really straight forward once you understand (of course).
From the IBM Redbook mentioned above, sg247770.pdf, we need to configure ActiveMQ as a Generic JMS provider in WAS. And since we want to use Activation Specs, again from the Redbook, we need to use the ActiveMQ Resource Adapter, or rar file. There is a link on the ActiveMQ page to the latest rar, I don't need to provide it here. Once the rar is installed, using the WAS Console/Resources/Resource Adapters menu, you can configure J2C CFs, ASs, and administered objects including Queues and Topics from the rar configuration page. These will all have custom properties where you will enter your destinations, etc.
I'm new to JMS programming (Java).
I have a machine M1, in a domain D1 and a machine M2 in another domain D2.
I have in M1 a JMS producer. And in M2 a JMS consumer. Both have as servers JBoss 7.2.
So it seems the only solution is to create a JMS bridge.
I'm reading the official documentation. So I wonder if creating an SSH tunnel is necessary.
Second, in which hornetq-configuration.xml file should I set the following configuration?
<bridge name="my-bridge">
<queue-name>jms.queue.sausage-factory</queue-name>
<forwarding-address>jms.queue.mincing-machine</forwarding-address>
<filter-string="name='aardvark'"/>
<transformer-class-name>
org.hornetq.jms.example.HatColourChangeTransformer
</transformer-class-name>
<retry-interval>1000</retry-interval>
<ha>true</ha>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<reconnect-attempts>-1</reconnect-attempts>
<failover-on-server-shutdown>false</failover-on-server-shutdown>
<use-duplicate-detection>true</use-duplicate-detection>
<confirmation-window-size>10000000</confirmation-window-size>
<user>foouser</user>
<password>foopassword</password>
<static-connectors>
<connector-ref>remote-connector</connector-ref>
</static-connectors>
<!-- alternative to static-connectors
<discovery-group-ref discovery-group-name="bridge-discovery-group"/>
-->
</bridge>
Should it be in the in JBoss server of the JMS producer machine or consumer machine?
My third question is, is there a difference in settings between JMS bridge and core bridge?
I would be so thankful for any additional information and explainations!
Thank you a lot!
I know this is little late for OP, may be this information helps someone.
Firstly, the difference between Core and JMS bridge.
Read doc here
Core bridges are for linking a HornetQ node with another HornetQ node and do not use the JMS API. A JMS Bridge is used for linking any two JMS 1.1 compliant JMS providers.
The Core bridge uses proprietary HornetQ core api so it can only connect two HornetQ servers. Whereas JMS bridges use the JMS API so could connect any JMS1.1 API complaint servers.eg: HornetQ to ActiveMQ.
The configuration mentioned in question is Core bridge and can be configured in the source server.Since you seem to connect two HornetQ server Core bridges is the way forward. That said, in your case you could use JMS bridges as well since both are JMS complaint.But the recommended approach would be to use Core bridge due to performance advantage gain.
Finally, the JBoss installation server comes with some handy examples.You could find Core bridge example under [JBOSS_HOME]\jboss-as\extras\hornetq\examples\jms\bridge.
I have deployed my camel integration projects (WAR) on a JBoss Wildfly application server.
I was wondering if there is a way to see what endpoints are available and what the URL's are?
In a similiar way as i can log into the administration console under Wildfly and select web services to get an overview of what is deployed?
Thanks in advance for your help.
Yes, if you have JMX enabled on your camel context, then you can view a list of endpoints via jconsole, as you can see from:
JMX is on by default according to the camel site but if you've somehow disabled it, adding:
<jmxAgent id="agent" disabled="false"/>
to your <camelContext> element should be enough to re-enable it.
There is also hawtio which is a web console to manage Java stuff, and it has plugins for Apache Camel, JBoss, and others too.
You could then install hawtio in wildfly, and then see your Camel routes / endpoints and whatnot
http://hawt.io/
We're using Jboss, but we are really only using its JMS stuff. So, is there a way that I can trim down what's loaded when Jboss starts?
You can go for a servlet container (Tomcat) + a JMS provider (ex. ActiveMQ), without using an application server at all.
From 6 years ago, here's a blog entry about configuring JBoss with "just the right stuff."
I haven't used JBoss in a few years, but in v4.0, you could just drop the desired jar files into the deployment directory, and JBoss would load... only those jars.
The correct way to do this, is making a separate profile on your JBoss server that contains only the things needed to use JMS. JBoss v5 comes standard with several profiles: minimal, default, standard, all and web. Each of those starts other services. If you do not specify any profile, you're using the "default" profile.
You can create your own profile starting from a copy of the minimal profile and adding services as needed for JMS support.
The JBoss documentation contains a bit of information on what the files in those profile directories are used for. See Jboss server configurations.
You didn't specify which version of JBoss that you are using. Keep in mind that there are some changes in the configuration between JBoss v4 and JBoss v5/6. The referenced documentation in the answer from Cheeso points to JBoss v4.