Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar

Summary:

This article provides the steps for using ConsumeJMS and PublishJMS processors with Weblogic Topics and Queues.

Prerequisites:

In this article a Weblogic 12c server was used with HDF-3.3.0. Also, for this article the JMS Server, Connection Factory, Queue and Topic have already been added to the Weblogic server. These blogs were used as references for this article, Install Weblogic 12.1.3 server, Basic JMS Demo using WebLogic Queue. Much of the credit for the information here goes to @emattos and @Jay Kumar SenSharma, both provided a great deal of assistance in understanding the Weblogic server and sample java programs for testing.

Also, for this you will need the wlfullclient.jar, this can be created by following this guide: Using the WebLogic JarBuilder Tool

Note: The JndiJmsConnectionFactoryProvider controller service was introduced in HDF-3.3.0. So, this controller service isn’t available in any earlier versions of HDF.

NiFi Setup:

In this article we'll use a simple flow to demonstrate the functionality of the processors. This is not meant to be an exhaustive article on the PublishJMS and ConsumeJMS processors. Just the information required to get the processors working.

The configuration of the controller service is based on the configuration of a very simple queue and topic in a Weblogic 12c server. A full explanation of the creation of the JMS server, Connection Factory, Queue and Topic can be found in the blogs listed in the beginning of the article. For reference, here is the configuration of the Weblogic server used for this article.

JMS Server

96428-screen-shot-2018-12-20-at-45054-pm.png

JMS Module

96429-screen-shot-2018-12-20-at-45146-pm.png

The Connection Factory, Queue and Topic.

96430-screen-shot-2018-12-20-at-45355-pm.png

Based on the above information, this is the configuration of the JndiJmsConnectionFactoryProvider controller service:

96431-screen-shot-2018-12-20-at-45906-pm.png

The Initial Naming Factory Class property is used to identify the factory that actually creates the Context. To use WebLogic JNDI, you use weblogic.jndi.WLInitialContextFactory.

The Naming Provider URL, specifies the URL of the WebLogic Server that provides the name serviceused, for this tutorial it is just the default value.

The controller service uses the Java Naming and Directory Interface (JNDI) to lookup a JMS connection factory. So, the JNDI name of the Connection Factory, MCF1, is used in the Connection Factory Name property of the controller service.

The Naming Factory Libraries property just identifies the jar with the Initial Naming Factory Class.

Now that the controller service is configured, the processors can be configured.

The PublishJMS processor flow.

96432-screen-shot-2018-12-20-at-50957-pm.png

The flow simply tails the local nifi-app.log file, splits the flow files into single log lines and then writes the log lines to queue Queue1 and topic Topic1.

The configuration of the PublishJMS processor for Queue1

96434-screen-shot-2018-12-20-at-51520-pm.png

The Destination Name property can be seen in the Weblogic console.

96435-screen-shot-2018-12-20-at-41916-pm.png

The configuration of the PublishJMS processor for Topic1 is the same except for the Destination Type and Destination Name properties.

96436-screen-shot-2018-12-20-at-51747-pm.png

Here is the simple flow demonstrating the ConsumeJMS processors for Queue1 and Topic1.

96437-screen-shot-2018-12-20-at-53129-pm.png

The configuration of the ConsumeJMS processors are the same for the Connection Factory Service, Destination Name and Destination Type properties.

96438-screen-shot-2018-12-20-at-53315-pm.png

96439-screen-shot-2018-12-20-at-53332-pm.png

3,286 Views
Comments
avatar
New Contributor

Hi Wynner, 

 

Article was good. I'm getting below error and i had included wlfullclient.jar in Naming Factory Libraries.  Can you help me..

 

Caused by: javax.naming.InvalidNameException: t3://testurl.com:39101
at com.sun.jndi.fscontext.FSContextFactory.getFileNameFromURLString(FSContextFactory.java:119)
at com.sun.jndi.fscontext.RefFSContextFactory.createContext(RefFSContextFactory.java:41)
at com.sun.jndi.fscontext.RefFSContextFactory.createContextAux(RefFSContextFactory.java:47)
at com.sun.jndi.fscontext.FSContextFactory.getInitialContext(FSContextFactory.java:49)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at org.apache.nifi.jms.cf.JndiJmsConnectionFactoryProvider.createInitialContext(JndiJmsConnectionFactoryProvider.java:213)
at org.apache.nifi.jms.cf.JndiJmsConnectionFactoryProvider.lookupConnectionFactory(JndiJmsConnectionFactoryProvider.java:168)
... 22 common frames omitted
Caused by: java.net.MalformedURLException: unknown protocol: t3

avatar

@ksha 

The URL looks incorrect: t3://testurl.com:39101.

Is the name of the sever where the WebLogic server is running testurl.com?

Is the port 39101 correct? The default port for WebLogic is 7001.

avatar
New Contributor

Screenshot (1003)_LI.jpg

Hi Wynner,

 

I am trying to publish the message on queue following the same procedure but geeting this error.

Thank you

Version history
Last update:
‎08-17-2019 05:10 AM
Updated by:
Contributors