We have two applications which is running on Weblogic and JBoss AS respectively. We would like to Keep HornetQ as an intermediate server for Asynchronous messaging.
I would like to write a Publish/Subscriber. Whenever a data Inserted/Modified/Deleted(JPA) or whatever possible messages it could be.
Here Producer will be the Weblogic and consumer will be the JBOSS. How can i achieve it?
On wls end define a foreign jms server. Point it to the hornetq topic. Your application on wls will publish
Messages to foreign jms and your application on jboss can consume it.
When defining foreign jms make sure you provide user credentials for both the topic and jndi look up as needed.
I think You could use JMS bridge between wls and JBoss:
http://docs.jboss.org/hornetq/2.3.0.CR2/docs/user-manual/html/jms-bridge.html
Related
In Apache's ActiveMQ Artemis documentation, there is a statement:
Apache ActiveMQ Artemis does not have a JNDI server. Rather, it uses a client-side JNDI implementation that relies on special properties set in the environment to construct the appropriate JMS objects. In other words, no objects are stored in JNDI on the Apache ActiveMQ Artemis server, instead, they are simply instantiated on the client based on the provided configuration.
Now, I don't understand how does a client, e.g. Widlfly, connect to the standalone Artemis broker. I know there is a client library provided as a Wildfly's module, and I know to configure JMS bridge between local WF queue and remote one. But how does it know how to connect using client's JNDI server? Does it mean that by configuring standalone.xml file of Wildfly you configure JNDI names for looking up resources on Wildfly which are responsible for communication or am I missing something? What the quoted sentence has to do in Artemis' documentation then?
One of the goals of interfaces like JMS and JNDI is to relieve client applications of the burden of having to "know" anything about the underlying implementations. So, for example, an application written using JMS and JNDI can connect to any JMS compliant broker which provides a JNDI implementation. One day a standalone Java application can connect to ActiveMQ and the next day it can connect to WebLogic and all that would need to change is the configuration in jndi.properties.
Any Java application using the JMS and JNDI APIs, whether it's running standalone or in an application server like Wildfly, can connect to ActiveMQ Artemis if the JNDI configuration is correct. As long as you provide the correct JNDI configuration then it will "know" how to connect because all that knowledge is contained with the ActiveMQ Artemis JMS and JNDI implementation and is abstracted away from the application behind the interfaces.
The section you quoted from the ActiveMQ Artemis documentation is simply to explain to users that there is no network client/server communication when using its JNDI implementation. This is, for example, in contrast to Wildfly which does implement a "real" JNDI server and whose JNDI client does communicate over the network to look up objects.
Where objects are physically stored depends on what JNDI implementation you use. If you're using the Wildfly JNDI implementation then objects are stored on the server and any client communicates with the server to look up those objects. If you're using the Artemis JNDI implementation then objects are stored in the actual client-side JNDI implementation. Whether or not classes are modularized has no impact on the JNDI lookup.
Java objects stored in JNDI can be any kind of Object. The JNDI implementation doesn't care what kind of Object it is. You can store an Artemis JMS connection factory pointing to a remote Artemis broker in Wildfly's JNDI. If you have such a configuration and a JMS application in Wildfly looks up this Artemis JMS connection factory from Wildfly's JNDI then the JMS connection factory implementation itself will communicate with the remote Artemis broker.
Additional notes:
JNDI is not a protocol. It's just an API.
If you're using the Artemis JMS client in Wildfly it will certainly not be using JNDI to call objects on the remote Artemis broker. As noted previously, the Artemis JNDI implementation is client-side only. It performs no network communication whatsoever. The Artemis JMS client implementation performs network communication using its own "core" wire protocol.
ActiveMQ Artemis is most commonly used standalone so it needs its own JNDI implementation to facilitate JMS compliance.
Instructions on how to use the ActiveMQ Artemis JNDI implementation are in the documentation you cited previously.
I'd like to host apps that uses queue to communicate with each other on OpenShift.
One kind of apps - producers will put some data to the queue and another type - consumer will process the message. My question is how to implement message queue. I've thought about two approaches:
Create an app with JBoss, HornetQ and consumer and create proxy port for HornetQ, so that producers can send messages there.
Create an app with JBoss and consumer, and make a JBoss's HornetQ available to producers. It sounds a bit better for me, but I don't know if I can make queue available to producers and how it works if there are more instances of consumer on different nodes (and different JBoss instances).
I'm not sure how else to answer you besides showing you a link on how to use Wildfly. You can just use the Wildfly Cartridge:
https://www.openshift.com/quickstarts/wildfly-8
If you provide me some extra context I can try to enrich the answer a bit better. I need to know what is your problem, and what's not working.
If you just want to know how to configure Wildfly with HornetQ, the Wildfly cartridge I posted is the way to go.
From architecture point of view, I was wondering what would be the best practice on an integration scenario with 2 application and OSB as Middleware: JMS Consumer runs over JBoss while OSB application encapsulates a service provider. Should JMS Queues reside on the JBoss (foreign server) or on WebLogic Server? That is, If I get to choose, JMS Server should be on consumer or producer side? What would be the pros and cons?
Thanks in advance.
It depends on your needs, you can create a foreign destination in your web logic server that connects to the producer queue in the producer end. In this arrangement your consumer will listen in the local end of the foreign destination that connects to the producer queue.
I can think of the following benefits:
A> Foreign Destinations are mapped to WebLogic JNDI tree, any MDB that you deploy to the server can simply reference the remote destination using its local JNDI name.
B> As you are directly communicating with the remote resource there is no lag / latency in delivery etc.
C> One issue maybe you will not be able to produce messages in the consuming end because this user may not have enqueue access to the queue. But it all depends on your setup. This maybe required for some cases like testing etc.
We have a server app that is deployed across to server machines, each running JBOSS 4.2.2. We use JBOSS messaging with MDBs to communicate between the systems. Currently we need to start the servers in a very specific order so that JBOSS can connect properly. If a server starts and doesn't see its resources it never tries again. This is problematic and time consuming in testing when we're bouncing servers constantly. We believe that if we could specify a retry flag in JBOSS could reattempt to get the connection.
Is there a flag/config option in JBOSS that would reattempt to obtain JMS connections on failure at startup?
I am quite new to the JMS technology, so it is entirely possible that I have mixed up some terms here. Since this capability is to be used in house experimental or deprecated options are acceptable.
Edit: The problem is that a consumer starts up with no producer available and subsequently fails, never to try again. If a consumer and producer are up and the producer dies the consumer will retry for the producer to come back.
I'm 95% sure that JBoss MDBs do retry connections like that. If your MDBs are not receiving messages as you expect, I think something else is wrong. Do the MDBs depend on any other resources. Perhaps posting your EJB descriptors (META-IF/ejb-jar.xml and META-IF/jboss.xml) would help.
Is there a way to tell JMS in JBoss to delay processing of messages already in the persistent queue for a while, e.g. 2 minutes, while JBoss starts.
As it is right now, when we restart JBoss, JMS starts to dispatch messages to the MessagesListeners even before JBoss has started properly.
We're running JBoss 4.2.3
I have found an annotation called Depends where an ejb or other service can list what you depend on:
http://docs.jboss.org/ejb3/docs/reference/build/reference/en/html/jboss_extensions.html
To actually start an ejb when ther server is up and listening this works best:
http://community.jboss.org/wiki/BarrierController