JMS provider URL for jboss in-vm destination - jms

Running app on EPA 7 with log4j2. We have an appender that writes to a JMS queue.
I got it working for remote connection as below:
<JMS name="HIFAuditAppender"
destinationBindingName="jms/queue/HIFAuditQueue"
factoryBindingName="jms/RemoteConnectionFactory"
providerURL="http-remoting://127.0.0.1:8080"
username="hcmuser"
password="gators123="
factoryName="org.jboss.naming.remote.client.InitialContextFactory" />
However, the JMS producer and MDB are running in the same JVM. I want to use the jboss in-vm connector, but have not been able to determine what the providerURL should be set to.

The providerURL will be same i.e http-remoting://127.0.0.1:8080. You need to use in-vm connection factory i.e /ConnectionFactory which uses in-vm connector and used to produce/consume messages locally.

Related

Generic JMS client library for Weblogic, Webshere and JBoss servers

We have a requirement for one standalone Java application that can push JMS message to a JMS queue configured on Weblogic, Websphere and JBoss application server.
Is there any generic JMS client library available, that we can use in our application for pushing the messages to any or all of these servers?
As we understand, there is a specific JMS client for each server (for e.g. wljmsclient.jar required for Weblogic target server, as we would need weblogic.jndi.WLInitialContextFactory to be available as Initial Context factory class, similarly for Websphere and JBoss). And we would like to avoid having 3 different JMS client libraries (1 each for server) in the same application.
However, the catch here is, destination server is not known during compilation time. Only during runtime, it will be known whether the given message is to be pushed to Weblogic, Websphere or JBoss server or all of them. Hence, there is a need for a deployed application to support all 3 servers during runtime.
Is there any alternative generic JMS client library?
You can develop your own client that supports the 3 servers.
Basically you need to have for your standalone application :
The different JMS provider jar on the classpath
For example a jms_config.properties file which stores the configuration for each server (initial context factory, etc.)
Then from a generic code you can build the InitialContext, JMS Queues, etc. depending on the target server.

not able to send message to remote Tomcat and ActiveMQ queue

I have a set of JMS queues configured on a Tomcat + ActiveMQ server. I have created a Resource for connectionFactory (by pointing the Broker to tcp:localhost:61616) and a resource for Queue in Server.xml inside global resource and then declared these 2 resource as in context.xml.
Now I'm trying to connect this queue from another tomcat server and send message. When trying to get lookup for connection factory with jndi name I am getting NamingException - name not bound in this context for the ConnectionFactory JNDI.
I tried to achieve like this:
set below values in properties
Provider_URL = http://Localhost:8080
INITIAL_CONTEXT_FACTORY = org.apache.naming.java.javaURLContextFactory
and then create new InitialContext with above property value and then lookup for the jndi of connectionFactory.
But its not working.
I tried other option to directly get context of the ActiveMQ by using ActiveMQContextFactory as INITIAL_CONTEXT_FACTORY and Provider_URL= tcp://localhost:61616
and I kept a simple jndi.properties file in the classpath of client tomcat server as it is mentioned in other posts. And It works well.
But I do not like it. Because when I configured the activeMQ connection and Queue as a resource in Tomcat, that means I should be able to get JNDI lookup through Tomcat and not directly to Active mq. I do not want to give ActiveMQ host:port to all my clients.
I assume there must be something incorrect on Tomcat server configuration that its connectionfactory/queue JNDI is not available for lookup outside.
I have struggle a lot today. Can someone expert point me to some possible mistake.
Thanks in advance.

Configuring resource in Tomcat's context.xml to access remote Weblogic JMS queues

What I intend to do is access remote queues in Oracle Weblogic JMS (version 10.3.4) from a spring application deployed in Tomcat7.
For this I am trying to configure a Resource (eg JMS connection factory, queues etc) in Tomcat's context.xml file. Then access this resource using jndi lookup in the spring configuration file and provide it to the necessary beans. I have already created connection factory and queues in Weblogic JMS and they can be accessed using jndi names.
I am able to make it work successfully when using ActiveMQ instead of Weblogic JMS. However with Weblogic JMS, I am facing an issue with configuring the Resource element. I am not sure what attributes to be used with Resource tag while connecting to Oracle Weblogic JMS.
When working with ActiveMQ the resource element config looks like below
<Resource name="jms/MyConnectionFactory" auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
description="JMS Queue Connection Factory"
brokerURL="tcp://localhost:61616" brokerName="MyActiveMqBroker"/>
I am struggling to find the configuration to be used with Oracle Weblogic JMS. I have gone through documentations to see how to do it but with no luck.
Any help or pointers would be highly appreciated.
Thanks.

How websphere server creates and manages JMS resources internally

When we set up a queue connection factory, a topic connection factory, a queue, a topic in websphere application server throguh the console, what exactly happens?
The server stores the configuration details in an xml and at server startup, it creates the connection factory(ies), topic(s),queue(s) and puts them in a pool?
I ask because the actual queue(s) and topics(s) itself do not reside on the App server, they reside on a separate (remote) websphere MQ server. So why do we need to 'create' the queues in Websphere App server?
The configuration is metadata for connecting to the remote objects. When the server starts (or an app restarts, or configuration is refreshed), the server reads the .xml, then binds Reference objects into JNDI. The actual connection factories aren't created/pooled until the Reference is first looked up.
I don't have enough experience with JMS to answer your second question, but presumably the metadata is required for the queue in order to access it remotely.

What is Foreign JMS provider? What is the typical role of Weblogic in a JMS application?

Currently I am working on a JMS application. But I use plain JMS API and Property file for configurations. My application is running in Weblogic and connects to MQ series server of my client.
Recently I got to know I can use Weblogic for JMS configurations.
Please explain.
What is "Foreign JMS provider"?
Is Weblogic also a JMS server or Foreign JMS provider or Both?
Weblogic provides the JMS Server features fully compliant with all JMS spec elements such as ConnectionFactory and Destinations. On this JMS Server you can connect and send messages to the client's Messaging Server via a configured Destination.
In addition using Weblogic as the JMS Server gives you lot many features such as Message Retry in case of failure, setting message quotas as well as enhanced monitoring of the JMS Server to track errors. The idea is to have more configuration driven settings for performance, deadlocks, tuning, filestore or database store etc.
A full list of such features is given at http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/fund.html#wp1071787
A Foreign JMS Provider in Weblogic is the term used to define JMS implementations other than Weblogic JMS. An example is IBM MQ in your case.
Once the Foreign Provider is configured within Weblogic, for all practical purposes within the code - it can be called as if it was on local JNDI lookup. Weblogic will make the remote calls transparent to your code. This allows you to change your destination via configuration on the Weblogic console.
You will need a Messaging Bridge within Weblogic JMS Server to connect a source destination from which messages are received, and a target destination to which messages are sent.
Some essential reading on this is at: http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms_admin/advance_config.html#wp1075917
and an example of configuring IBM MQ as a Foreign Provider is at http://www.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html#N1011D

Resources