Using The JNBridge JMS Adapter For With SonicMQ

Transcription

Using the JNBridge JMS Adapter for .NETwith SonicMQversion 4.0www.jnbridge.com

Using the JMS Adapter with SonicMQJNBridge, LLCwww.jnbridge.comCOPYRIGHT 2008-2016 JNBridge, LLC. All rights reserved.JNBridge is a registered trademark and JNBridgePro and the JNBridge logo are trademarks of JNBridge, LLC.Oracle and Java are registered trademarks of Oracle and/or its affiliates.Microsoft, Windows, Windows Server, BizTalk and the Windows logo are trademarks, or registered trademarks ofMicrosoft Corporation in the United States and/or other countries.All other marks are the property of their respective owners.This product includes software developed by the Apache Software Foundation (http://www.apache.org/).2Version 4.0

Using the JMS Adapter with SonicMQContentsQuick Config for SonicMQ. 4Binding Properties Tab. 4URI Properties Tab. 4Using the JMS Adapter with SonicMQ. 5Resources. 5Machine Prerequisites. 5Configuring the Adapter Connection Properties. 6Binding Properties Tab. 6JNBridge Properties Category. 8URI Properties Tab. 9Security Tab. 9Touble Shooting. 10Using the Support Initial Context Factory. 10Version 4.03

Using the JMS Adapter with SonicMQQuick Config for SonicMQBinding Properties Tab Initial Context Factory: com.sonicsw.jndi.mfcontext.MFContextFactory JMS Scheme: tcp Queue Factory:No connection factories come preconfigured in the Sonic MQ JNDI repository. These must beconfigured Topic Factory:No connection factories come preconfigured in the Sonic MQ JNDI repository. These must beconfigured Class Pathsonic Client.jar, mfcontext.jarThe client JAR file, sonic Client.jar, contains a classpath in its manifest. As such,the directory must also contain: sonic XA.jar. In addition, if SSL is being used, thenrsa ssl.jar must be included in the classpath. This jar file also contains a classpath inits manifest, so the directory must also contain: asn1.jar, certj.jar, sslj.jar,jsafe.jar and jsafeJCE.jar JVM Path (example)C:\Program Files\Java\jre7\bin\client\jvm.dllURI Properties Tab Port Number: 25064Version 4.0

Using the JMS Adapter with SonicMQUsing the JMS Adapter with SonicMQThis document uses the example JMS service that comes pre-configured in SonicMQ. This documentassumes some passing familiarity with enterprise Java such as JNDI contexts, factories and generalconnection requirements and parameters. This document also assumes that the .NET developer has accessto particular information peculiar to the target JMS implementation. Finally, this document assumes thatthe reader is knowledgeable and experienced with .NET.This document assumes that SonicMQ is stand-alone rather than deployed to a JEE applicationserver as the messaging provider using a JCA connector. If this is the case, then refer to the SonicMQdocumentation and the JEE app server documentation.This document only discusses those property values that pertain to communicating with SonicMQ. Otherproperties that are not discussed here can be found in the companion Using the JNBridge JMS Adapter for.NET document.Resources The user guide, JNBridge JMS Adapter for .NET Users’ Guide. Chances are, if the target JMS implementation is mature, the values for the configuration of can besupplied by the SonicMQ administrator, developers or gleaned from existing JMS client code. It is strongly suggested that the developer read the section Tips and Tricks in the JNBridge JMSAdapter for .NET Users’ Guide.Machine PrerequisitesThe following prerequisites are needed for the adapter. A public Java Run-time Environment (JRE) must be installed on the target machine. The JNBridgeJMS Adapter supports the Standard Edition JRE 7 or above. The JNBridge JMS Adapter for .NET uses a stand-alone client JMS environment supplied bySonicMQ. This stand-alone client consists of several files.Version 4.05

Using the JMS Adapter with SonicMQConfiguring the Adapter Connection PropertiesThe Add Adapter Service Reference development tool in Visual Studio is used to generate theapp.config file and the WCF client file. The WCF client contains the methods chosen to send andreceive JMS messages. The app.config file contains the binding element whose attribute values are theparameters used to initialize and connect to the JMS server. Each of the binding attribute values can beentered in the Binding Properties tab of the Configure Adapter dialog box. While it is possible to enterthese values and then connect to the JMS server from the Add Adapter Service Reference dialog box, itis more efficient to work off-line and generate the app.config and the WCF client using only the genericoperations. Please see the section Tips and Tricks in the JNBridge JMS Adapter for .NET Users’ Guide formore information about working off-line and using the generic operations.What follows are the property values required to connect to the SonicMQ. The version of SonicMQdiscussed in this document is 7.6.Binding Properties TabThe JMS Properties category are properties used to properly connect to a JMS server. Choose JMS VendorThis is a drop-down control that comes pre-charged with default vendor connectionproperties. Click and select SonicMQ and the default configuration values will automaticallyappear. Custom Connection StringThis is a text-editable field. This property is only used if the JMS implementation usescomplex URLs containing query expressions, or some proprietary connection string. that cannot be constructed from the Host Name and Port Number properties. If this property containsa value, then the Host and Port properties in the URI tab will be ignored. JMS Acknowledge ModeThe Acknowledge Mode is a drop-down list containing the JMS specification that determineshow a JMS client and server institute a reliable messaging protocol. The choices are AUTOACKNOWLEDGE, CLIENT ACKNOWLEDGE and DUPS OK ACKNOWLEDGE. Regardlessof the choice, the JNBridge JMS Adapter will correctly implement the protocol. For a defaultSonicMQ connection factory, AUTO ACKNOWLEDGE is the default configuration. Initial Context FactoryThis is a text-editable field containing the name of the JNDI initial context factory. The initialcontext factory is a JNDI class used to locate and instance factories and JMS destinations.The default initial context factory for the SonicMQ JNDI implementation:6Version 4.0

Using the JMS Adapter with If SonicMQ is used as a messaging provider with another J2EE app server, then the JNDIinitial context class may be different.If a named SonicMQ domain is being used, or if a fail-over naming broker is being used,then see the section Trouble Shooting. This section will explain how to use the initial contextfactory installed along with the adapter to pass the domain name and fail-over naming brokername to SonicMQ. The initial context factory that passes the domain name and fail-overnaming broker to the SonicMQ broker y!Factory names are case sensitive—be sure the name (including the completenamespace, if necessary) is typed correctly. JMS SchemeThis is a text-editable field. The JMS Scheme or Protocol is particular to each vendor’s RMIimplementation. The protocol is part of the URI used to connect to the JMS service.For SonicMQ, the scheme is:tcp JMS VersionThis property tells the adapter which JMS implementation to expect when it loads thevendor’s client stack—the JAR files in the Class Path property. The drop-down list containstwo choices, ‘JMS 1.1’ and ‘JMS 2.0’. JMS Security ModeThe JMS Security Mode is a drop-down list that specifies the type of security required by theJMS server implementation. The choices are none, simple and strong. If the choice is simple,then the server expects a user name and password.!If the JMS server implements simple security, it is not necessary to configure thisproperty. Enter a user name and password—the JNBridge JMS Adapter willautomatically switch to the simple security mode. Queue Connection FactoryNo connection factories come preconfigured in the Sonic MQ JNDI repository. These must beconfiguredVersion 4.07

Using the JMS Adapter with SonicMQ!This value includes the JNDI directory path to the connection factory. The completeJNDI path must be provided. Topic Connection FactoryNo connection factories come preconfigured in the Sonic MQ JNDI repository. These must beconfigured!This value includes the JNDI directory path to the connection factory. The completeJNDI path must be provided.JNBridge Properties CategoryThe JNBridge Properties Category correctly configure the .NET-to-Java interoperability core components. Class PathThe Java class path is a set of semicolon-separated paths to the JAR or class files required fora JMS client installation. The class path is used by the JNBridge Java to .NET interoperabilitycomponents to locate the JMS and JNDI client Java classes so they can be instanced in theJava Virtual Machine.To edit the class path, click in the field to enable the browse button. Click on the button tolaunch the Edit Class Path dialog. Note that only checked elements will be added to the classpath when the dialog is dismissed.The SonicMQ jar file required by the JMS adapter:[SonicMQ Directory]\MQ7.6\lib\sonic Client.jar[SonicMQ Directory]\MQ7.6\lib\mfcontext.jarThe client JAR file, sonic Client.jar, contains a classpath in its manifest. As such,the directory must also contain: sonic XA.jar. In addition, if SSL is being used, thenrsa ssl.jar must be included in the classpath. This jar file also contains a classpath inits manifest, so the directory must also contain: asn1.jar, certj.jar, sslj.jar,jsafe.jar and jsafeJCE.jar. These additional files are also found in the in the ‘lib’directory.If the work-around initial context factory, installed with the adapter, that supplies theSonicMQ domain name and/or fail-over naming broker to the server is used, then the JAR filecontaining the fixed factory, jnb sonic icf fix.jar, must be placed before mfcontext.8Version 4.0

Using the JMS Adapter with SonicMQjar in the Class Path property. Please see the section Trouble Shooting. JVM PathThe JVM Path property is the absolute path to the Java Virtual Machine implementation,jvm.dll. To edit the JVM Path property, click in the field to enable the browse button.Click on the button to launch the standard File Open dialog. Navigate to jvm.dll andclick OK. In the example shown, the JRE used is:C:\Program Files\Java\jre7\bin\client\jvm.dllURI Properties TabThis category provides the location of the host where SonicMQ is running and the port that SonicMQlistens to for connections. HostThe host name or IP address of the machine running SonicMQ. PortThis is a text editable field. Enter the port where SonicMQ is listening for client connections.By default this is port 2506.Security TabThis tab need only be used if security is implemented in the SonicMQ server and is of type simple.Note that the password will appear in clear text in the app.config file. Please see the section DeployingSolutions in the Users’ Guide. Client credential typeThis is a drop-down control. Choose the credential type Username. User nameEnter the user name credential. PasswordEnter the password credentialVersion 4.09

Using the JMS Adapter with SonicMQTouble ShootingUsing the Support Initial Context FactorySonicMQ has the concept of broker domain names. As such, a JMS client, like the adapter, must specifythe domain name in the connection properties. SonicMQ uses a JEE property, com.sonicsw.jndi.mfcontext.domain, to specify the domain name. If no domain name is used in the SonicMQ implementation, thenthere is no need to specify the name in the connection.The problem is that the JEE property cannot be passed to the JVM using the ‘-D’ argument. Instead, theproperty must be specified in the arguments used to construct the JNDI initial context. The JNBridge JMSAdapter for .NET does not allow this. Therefore, JNBridge support has supplied a special initial contextfactory that uses the ‘-D’ argument to specify the domain name and, also, to specify a fail-over namingbroker, if one is configured.The special initial context factory can be found in the zip file, SonicMQ ICF.zip. This archive islocated in the adapter’s installation directory, e.g. C:\Program Files\JNBridge\JMSAdapters\DotNet\support.The zip file contains the source for the initial context factory as well as the Eclipse project (Galileo JEE).To use the supplied work-around initial context factory unzip the archive to a convenient location. TheJAR file containing the initial context factory is jnb sonic icf fix.jar.Follow these instructions to use the work-around initial context factory.1. Copy the JAR file, jnb sonic icf fix.jar, to the location where the other JAR files thatconstitute the SonicMQ JMS client, sonic Client.jar and mfcontext.jar, are located.2. Modify the Class Path property in the Binding Properties tab by adding the new JAR file to theclasspath. The JAR file, jnb sonic icf fix.jar, must come before the JAR file, mfcontext.jar. Use the Edit ClassPath dialog to move the new JAR file ahead of mfcontext.jar.3. In the Initial Context Factory property in the Binding Properties tab enter this tory.4. In the JVM Arguments property in the Binding Properties tab enter this value to specify the SonicMQdomain name:-Dcom.sonicsw.jndi.mfcontext.domain [Domain Name]5. If a fail-over naming broker is being used, then enter this viderURL tcp://hostname:portnum10Version 4.0

Using the JMS Adapter with SonicMQIn addition to these two SonicMQ JEE properties, the following SonicMQ properties are also eVersion 4.011

To edit the class path, click in the field to enable the browse button. Click on the button to launch the Edit Class Path dialog. Note that only checked elements will be added to the class path when the dialog is dismissed. The SonicMQ jar file required by the JM