8 Oracle JCA Adapter for JMS

This chapter describes how to use the Oracle JCA Adapter for JMS (Oracle JMS Adapter), which enables an Oracle BPEL process or an Oracle Mediator component to interact with JMS.

This chapter includes the following topics:

8.1 Introduction to the Oracle JMS Adapter

The JMS architecture uses one client interface to many messaging servers. The JMS model has two messaging domains, point-to-point and publish-subscribe. In the point-to-point domain, messages are exchanged through a queue and each message is delivered to only one receiver. In the publish-subscribe model, messages are sent to a topic and can be read by many subscribed clients.

You can obtain JMS adapter sample files by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

This section includes the following topics:

8.1.1 Oracle JMS Adapter Integration with Oracle BPEL Process Manager

The JCA Binding Component is used for the bidirectional integration of the JCA 1.5 resource adapters with BPEL Process Manager. The JCA Binding Component is based on standards and employs the Web service Invocation Framework (WSIF) technology for exposing the underlying JCA interactions as Web services.

For information on Oracle JMS Adapter architecture, adapter integration with Oracle BPEL Process Manager (Oracle BPEL PM), and adapter deployments, see Chapter 3, "Adapter Integration with Oracle Application Server Components."

8.1.2 Oracle JMS Adapter Integration with Oracle Mediator

Mediator supports Oracle JCA Adapters and enables you to define inbound and outbound adapter services for each. An inbound adapter service receives data from an external messaging system and transforms it into an XML message. An outbound adapter service sends data to a target application by transforming an XML message into the native format of the given adapter.

In the case of Oracle JMS Adapter service, by using Mediator, you can send or receive messages from a JMS queue or topic.

Oracle BPEL PM pre-dates Mediator, and most of this guide and the samples implicitly assume use with Oracle BPEL PM. However, the adapters work equally well with either Oracle BPEL PM or Mediator. For any mention of Oracle BPEL PM in this chapter, you may substitute Mediator, instead.

8.2 Oracle JMS Adapter Features

The Oracle JMS Adapter includes the following features:

  • Is based on JMS version 1.0.2b

  • Is a generic Oracle JMS Adapter

    Works with any JMS provider. It has been certified against AQ JMS (JMS providers OJMS 8.1.7, 9.0.1.4, and 9.2), TIBCO JMS, IBM Websphere MQSeries (IBM MQSeries JMS 6.0), Weblogic JMS, Apache, and Active MQ.

  • Supports JMS topics and queues

  • Supports byte, text, and map message types.

    Supports these data types only for this release. The Adapter Configuration Wizard provides the Native Format Builder wizard for consuming native data payloads at run time. The Native Format Builder wizard creates XSD definitions for the underlying native data.

  • Supports JMS headers and properties

  • Supports jca.message.encoding property

    The Oracle JMS Adapter supports the jca.message.encoding property for inbound and outbound payloads. If the jca.message.encoding property is used along with the adapter.jms.encoding property and the nxsd:encoding attribute, then the jca.message.encoding property takes precedence over the adapter.jms.encoding property, and the nxsd:encoding attribute is given the last preference. The nxsd:encoding value can be UTF, which-8 is typically recommended for interoperability and Unicode support. However, you can specify any legal encoding supported by the Java runtime environment. For a complete listing of supported encodings, visit http://www.oracle.com/technetwork/java/index.html. Note that you you can specify the encoding in the (N)XSD associated with the adapter proxy meta data. For example, you can specify the following attribute, nxsd:encoding="iso-8859-1

    The jca.message.encoding property is supported as an endpoint yu76y76 defined in composite.xml You can define this property using the Properties tab of the Adapter Configuration Wizard or by editing the composite.xml file. The jca.message.encoding property can be passed as a normalized message property for both inbound and outbound interactions.

    The following code snippet is an example of setting values in the composite.xml file for message encoding for an inbound service:

     <service name="jms_inbound" ui:wsdlLocation="jms_inbound.wsdl">
        <interface.wsdl
       interface="http://xmlns.oracle.com/pcbpel/adapter/jms/utf8/jcamessageencoding/
         jms_inbound#wsdl.interface(Consume_Message_ptt)" />
        <binding.jca config="jms_inbound_jms.jca">
        <property name="jca.message.encoding" type="xs:string" many="false"
                    override="may">GBK</property>
      </binding.jca> 
    </service>
    

    The following code snippet is an example of setting values in the composite.xml file for message encoding for an outbound reference:

    <reference name="jms_outbound" ui:wsdlLocation="jms_outbound.wsdl">
        <interface.wsdl
         interface="http://xmlns.oracle.com/pcbpel/adapter/jms/utf8/jcamessageencoding/
         jms_outbound#wsdl.interface(Produce_Message_ptt)"/>
        <binding.jca config="jms_outbound_jms.jca">
        <property name="jca.message.encoding" type="xs:string" many="false"
                    override="may">GBK</property> 
      </binding.jca> 
    </reference>
    
  • Supports the JMS message selector

    Supports the JMS message selector for performing filtering while subscribing to JMS topics and queues. This parameter is based on the SQL 92 language for filtering messages based on fields present in the JMS header and properties section.

  • Is DOM2 compliant

    The Oracle JMS Adapter can process and generate document objects that are compliant with DOM2 specification.

  • Supports normalized message.

    Header manipulation and propagation is a key business integration messaging requirement. Oracle BPEL PM, Mediator, Oracle JCA, and Oracle B2B rely extensively on header support to solve customers' integration needs. For example, a user can preserve a file name from the source directory to the target directory by propagating it through message headers. Another example: the outbound Oracle JMS Adapter facilitates asynchronous request/response by propagating the correlationId and the JMSReplyTo address as JMS headers. In Oracle BPEL PM and Mediator, users can access, manipulate, and set headers with varying degrees of UI support.

    For more information, see Section 2.15, "Oracle BPEL Process Manager Correlation Support Within Adapters".

    Propagating Headers in a Normalized Message:

    Normalized Message is simplified to have only two parts, properties and payload.Typically, properties are name-value pairs of scalar types. To fit the existing complex headers into properties, they will be flattened into scalar types.

    Manipulating Headers in Design-Time:

    The user experience while manipulating headers in design time is simplified, because the complex properties are predetermined. In Mediator or Oracle BPEL designer, you can manipulate the headers with some reserved key words. For example, in Mediator designer, you can access an inbound Oracle File Adapter, fileName header by using the following expression:

    $nmproperty.InboundFileHeaderType.fileName
    

    However, this method does not address the properties that are dynamically generated based on your input. For example, in the Oracle AQ Adapter Wizard, you are allowed to propagate some of the fields from an AQ object as headers. Based on this user choice, the header definitions are generated. These definitions are not predetermined and hence cannot be accounted for in the list of predetermined property definitions. The user cannot design header manipulation of the dynamic properties before they are defined. To address this limitation, you must generate all the necessary services (composite entry points) and references. This restriction applies only to those services that are expected to generate dynamic properties. Once dynamic properties are generated, they must be captured in some given location for each composite. Only then can the user manipulate the dynamic properties in the Oracle Mediator or Oracle BPEL designer.

  • Supports specifying a durable JMS subscriber

  • Supports persistent and nonpersistent modes of a JMS publisher

  • Does not support connection retry functionality for MQ provider

  • Does not support outbound retry functionality for AQJMS on Solaris

    Note:

    When you use the Oracle JMS Adapter to connect to an AQ-JMS provider, and if the database that hosts the AQ destination is 10.1.0.4, then the adapter retry mechanism on the outbound direction will fail to reconnect to the database server if the database server goes down. This is because of a client JDBC issue with ojdbc14.jar. To resolve this you must download the 10.1.0.4 JDBC drivers and use them in the mid tier by replacing the libraries, specifically ojdbc14.jar in $MIDTIER_ORACLE_HOME/jdbc. For a detailed explanation about how to resolve this issue, refer to Metalink Note 317385.1.
  • The JMS API specifies three types of acknowledgments that can be sent by the JMS publisher:

    • DUPS_OK_ACKNOWLEDGE, for consumers that are not concerned about duplicate messages

    • AUTO_ACKNOWLEDGE, in which the session automatically acknowledges the receipt of a message

    • CLIENT_ACKNOWLEDGE, in which the client acknowledges the message by calling the message's acknowledge method

  • Supports tracking message size

    The Oracle JMS Adapter is message size aware. The Oracle JMS Adapter calculates the message size and reports the size back to the JCA Binding Component. The API, related to size, exposed by the JCA Binding Component can be used for reporting purposes.

  • Supports MapMessage Data Type

    A MapMessage is used to send a set of name-value pairs where names are strings and values are Java primitive types. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined. It inherits from a message and adds a map message body.

    Oracle JMS adapter provides support for processing MapMessage. It now supports one new ActivationSpec and InteractionSpec property each namely JmsMapMessageConsumeActivationSpec and JmsMapMessageProduceInteractionSpec.

    The PayloadEntry property specifies that the MapMessage entry will be used as the payload. Users have the option to send payload as an attachment if the AttachmentList property is defined.

    All other MapMessage entries are converted to adapter properties identified by jca.jms.Map.xxxx, where xxxx is name of the MapMessage entry.

    If both PayloadEntry and AttachmentList properties are not defined, then the entire MapMessage is converted to XML and the XML file is transferred as the payload.

  • Supports Enterprise Information System (EIS) Credentials

    The Oracle JMS Adapter supports securing of the Enterprise Information System (EIS) credentials such as the user name and password, whenever it establishes an outbound connection with EIS. You can secure the user name and password for Oracle JMS Adapter by using Oracle WebLogic Server container-managed sign-on.

    For more information about support for securing of the Enterprise Information System (EIS) credentials, see Section 4.2.22, "Securing Enterprise Information System Credentials."

  • Supports Streaming Large Payload

    Oracle JMS Adapter provides support to stream payload. When you enable this feature, the payload is streamed to a database instead of getting manipulated in the SOA run time as in a memory DOM. This feature can be used while handling large payloads. To enable support to stream payload, ensure that you select the Enable Streaming check box while defining the consume operation parameters on the Consume Operation Parameters page in Oracle JDeveloper (JDeveloper). When the Enable Streaming check box is selected, a corresponding Boolean property EnableStreaming is appended to the ActivationSpec properties defined in the respective .jca file, as shown in the following example. If the EnableStreaming property does not exist, then the default value of false is assumed.

    <activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
      <property name="DestinationName" value="jms/DemoInQueue"/>
      <property name="UseMessageListener" value="false"/>
      <property name="PayloadType" value="TextMessage"/>
      <property name="EnableStreaming" value="true"/>
    </activation-spec>
    
  • Supports Transactions

    A transaction enables an application to coordinate a group of messages for production and consumption, treating messages sent or received as a single unit. When an application commits a transaction, all messages it received within the transaction are removed by the JMS provider. The messages it sent within the transaction are delivered as one unit to all JMS consumers. If the application rolls back the transaction, then the messages it received within the transaction are returned to the messaging system and the messages it sent are discarded. The Oracle JMS Adapter supports JMS transactions. A JMS-transacted session supports transactions that are located within the session. A JMS-transacted session's transaction does not have any effects outside of the session.

  • Supports Error Handling

    For information about error handling, refer to Section 2.22, "Error Handling."

  • Supports Multiple Consumer Threads

    The Oracle JMS Adapter supports an activation endpoint property, "adapter.jms.receive.threads". Setting this property in composite.xml is a preferred way to spawn multiple poller threads for the inbound message flow between the adapter and the Enterprise Information System (EIS). This will help improve performance because multiple poller threads will dequeue message in a round robin fashion; this assists in Distributed scenarios as well.

  • Supports Performance Tuning

    The Oracle JMS Adapter supports performance tuning.

    For more information, see "Oracle SOA JMS Adapter Tuning" in the Oracle Fusion Middleware Performance and Tuning Guide.

Note:

Oracle JMS Adapter cannot be used programmatically inside an EJB or JMS client.

8.3 Oracle JMS Adapter Concepts

Messaging is any mechanism that enables communication between programs. Messages are structured data that one application sends to another. Message-oriented middleware (MOM) is an infrastructure that supports scalable enterprise messaging. MOM ensures fast, and reliable asynchronous communication, guaranteed message delivery, receipt notification, and transaction control. JMS is a Java interface developed by Sun Microsystems for producing, sending, and receiving messages of an enterprise messaging system. JMS is an API that JMS vendors implement. Oracle provides two implementations of JMS, WLS JMS and Oracle JMS based on Oracle advanced queues. A JMS producer creates JMS messages and a JMS consumer consumes JMS messages.

JMS supports two messaging paradigms, point-to-point (queues) and publish/subscribe (topics).

This section includes the following topics:

8.3.1 Point-to-Point

In point-to-point messaging, the messages are stored in a queue until they are consumed. One or more producers write to the queue and one or more consumers extract messages from the queue. The JMS consumer sends an acknowledgment after consumption of a message; this results in purging of the message from the queue.

8.3.2 Publish/Subscribe

In publish/subscribe messaging, producers publish messages to a topic, and the consumer subscribes to a particular topic. Many publishers can publish to the same topic, and many consumers can subscribe to the same topic. All messages published to the topic by the producers are received by all consumers subscribed to the topic. By default, subscribers receive messages only when the subscribers are active. However, JMS API supports durable subscriptions that ensure that consumers receive messages that were published even when the subscribers are not up and running. The durable subscription involves registering the consumer with a unique ID for retrieving messages that were sent when the consumer was inactive. These messages are persisted by the JMS provider and are either sent to the consumer when it becomes active again or purged from storage if the message expires. The JMS producer can be set either to persistent or nonpersistent mode. The messages are not persisted in the latter case and can be used only for nondurable subscriptions.

For scenarios that requires you to work with durable subscriptions on Oracle WebLogic Server, a connector factory with ClientID property defined is required, as shown in the following example:

<FactoryProperties>ClientID=uniquename</FactoryProperties>

When defining multiple durable subscriber it would entail you to define multiple connector factory each with a unique ClientID property specified. You must take care to not use the same connector factory for any other adapter interaction (such as outbound interaction if it is used for processing inbound messages) because Oracle WebLogic Server allows a clientid to be bound only once. For a scenario in which a connector factory with ClientId defined is used on the inbound to process incoming messages a different connector factory should be used for the outbound adapter interactions.

Note:

You must manually remove durable subscribers that are not used by the BPEL partner link. Oracle JMS Adapter does not automatically remove these durable subscriptions.

The JMS API supports both synchronous and asynchronous communication for message consumption. In the synchronous case, the consumer explicitly calls the receive() method on the topic or queue. In the asynchronous case, the JMS client registers a message listener for the topic or queue and the message is delivered by calling the listener's onMessage() method.

8.3.3 Destination, Connection, Connection Factory, and Session

The destination property contains the addressing information for a JMS queue or topic.Connections represent a physical connection to the JMS provider. The connection factory is used to create JMS connections. A session is used to create a destination, JMS producer, and JMS consumer objects for a queue or topic.

8.3.4 Structure of a JMS Message

The JMS message has a mandatory standard header element, an optional properties element, and an optional standard payload element. The payload can be a text message, byte message, map message, stream message, or object message. The properties element is JMS provider-specific and varies from one JMS provider to another.

8.3.5 Oracle JMS Adapter Header Properties

For information about the Oracle JMS Adapter header properties, see Appendix A, "Oracle JMS Adapter Properties."

8.4 Oracle JMS Adapter Use Cases

This section includes the following topics:

8.4.1 Configuring Oracle JMS Adapter

The following use case demonstrates the procedure for configuring Oracle JMS Adapter and examines the resulting WSDL files and associated weblogic-ra.xml files.

This section includes the following topics:

8.4.1.1 Creating an Application and a SOA Project

You must first create an JDeveloper application to contain the SOA composite. Use the following steps to create a new application and a SOA project:

  1. Open JDeveloper.

  2. In the Application Navigator, click New Application.

    The Create Generic Application - Name your Application page is displayed, as shown in Figure 8-1.

  3. Enter a name for the application in the Application Name field. For example, AQQueue2Queue.

  4. In the Application Template list, choose Generic Application.

    Figure 8-1 The Create Generic Application - Name your application Page

    Description of Figure 8-1 follows
    Description of "Figure 8-1 The Create Generic Application - Name your application Page"

  5. Click Next.

    The Name your project dialog is displayed, as shown in Figure 8-2.

  6. In the Project Name field, enter a descriptive name. For example, AQQueue2Queue.

  7. In the Available list in the Project Technologies tab, double-click SOA to move it to the Selected list.

    Figure 8-2 The Create Generic Application - Name your Generic project Page

    Description of Figure 8-2 follows
    Description of "Figure 8-2 The Create Generic Application - Name your Generic project Page"

  8. Click Next.

    The Create Generic Application - Configure SOA settings page is displayed, as shown in Figure 8-3.

    Figure 8-3 The Create Generic Application - Configure SOA Settings Page

    Description of Figure 8-3 follows
    Description of "Figure 8-3 The Create Generic Application - Configure SOA Settings Page"

  9. Select Composite With BPEL from the Composite Template list, and then click Finish.

    You have created a new application, and an SOA project. This automatically creates an SOA composite.

    The Create BPEL Process page is displayed, as shown in Figure 8-4.

    Figure 8-4 The Create BPEL Process Page

    Description of Figure 8-4 follows
    Description of "Figure 8-4 The Create BPEL Process Page"

  10. Enter a name for the BPEL process in the Name field. In this example, use the default name.

  11. Select Define Service Later in the Template list, and then click OK.

    You have created a BPEL process.

8.4.1.2 Using the Adapter Configuration Wizard to Configure Oracle JMS Adapter

The following are the steps to configure an Oracle JMS Adapter by using the Adapter Configuration Wizard:

  1. In the Component Palette, select SOA.

  2. Drag and drop JMS Adapter from the Service Adapters list to the Exposed Services swim lane in the composite.xml page.

    The Adapter Configuration Wizard is displayed.

  3. Click Next.

    The Adapter Configuration Wizard - Service Name page is displayed, as shown in Figure 8-5.

    Figure 8-5 Service Name Page

    Description of Figure 8-5 follows
    Description of "Figure 8-5 Service Name Page"

  4. Enter a name for the service, and then click Next.

    The Adapter Configuration Wizard - JMS Provider page is displayed, as shown in Figure 8-6.

    Figure 8-6 The Adapter Configuration Wizard - JMS Provider Page

    Description of Figure 8-6 follows
    Description of "Figure 8-6 The Adapter Configuration Wizard - JMS Provider Page"

  5. Select any one operation. In this example, select Oracle Weblogic JMS.

    • Oracle Enterprise Messaging Service (OEMS): This enables you to integrate with the Weblogic service or Advanced Queueing messaging service.

    • Third Party: Select this option to integrate with a third party provider.

  6. Click Next.

    The Adapter Configuration Wizard - Service Connection page is displayed.

  7. You must establish connectivity between the design-time environment and the server you want to deploy it to.

    Perform the steps mentioned in Section 2.7, "Creating an Application Server Connection for Oracle JCA Adapters" to create an application server connection.

  8. Click Next. The Adapter Interface page is displayed, as shown in Figure 8-7.

  9. In the Adapter Interface page, select Define from operation and schema (specified later).

    Figure 8-7 The Adapter Configuration Wizard - Adapter Interface Page

    Description of Figure 8-7 follows
    Description of "Figure 8-7 The Adapter Configuration Wizard - Adapter Interface Page"

  10. Click Next.

    The Adapter Configuration Wizard- Operation page is displayed.

  11. Select Consume Message, Produce Message, or Request/Reply. In this example, select Consume Message.

    The operation name is filled in automatically, as shown in Figure 8-8.

    Figure 8-8 The Adapter Configuration Wizard - Operation Page

    Description of Figure 8-8 follows
    Description of "Figure 8-8 The Adapter Configuration Wizard - Operation Page"

    The Consume Message option enables the adapter to consume (receive) inbound messages from a JMS destination.

  12. Click Next.

    The Adapter Configuration Wizard - Consume Operation Parameters page is displayed, as shown in Figure 8-9.

    Figure 8-9 The Adapter Configuration Wizard - Consume Operation Parameters Page

    Description of Figure 8-9 follows
    Description of "Figure 8-9 The Adapter Configuration Wizard - Consume Operation Parameters Page"

  13. Enter values for the following fields:

    • Destination Name

      This is the JNDI name of the JMS queue or topic from which to receive the message. This is not an editable field. You must click Browse to browse for the queue or topic. The queue or topic to be chosen is based on the type of JMS provider you are using.

      For more information, see the following sections:

    • Message Body Type

      The supported values are TextMessage, BytesMessage, MapMessage. The StreamMessage message type is not supported in this release.

    • Durable Subscriber ID

      This field is optional. If you are setting up a durable subscriber, then the durable subscriber ID is required. Generally, a subscriber loses messages if the subscriber becomes disconnected, but a durable subscriber downloads stored messages when it reconnects.

      Note:

      When the JMS provider is Oracle Weblogic JMS or Oracle Advanced queueing messaging service, then the Durable Subscriber option will show up only when a topic is selected. However, the Durable Subscriber option always appears when the JMS provider is a third party.
    • Message Selector

      This field is also optional. It filters messages based on header and property information. The message selector rule is a Boolean expression. If the expression is true, then the message is consumed. If the expression is false, then the message is rejected.

      For example, you can enter logic, such as:

      • JMSPriority > 3. Based on this, messages with a priority greater than 3 are consumed; all other messages are rejected.

      • JMSType = 'car' AND color = 'blue' AND weight > 2500

      • Country in ('UK', 'US', 'France')

    • Use MessageListener

      This field is always set to False by default.

    • JNDI Name

      The value specified in the JNDI name should exist in the Oracle JMS Adapter weblogic-ra.xml file to ensure that the adapter runs in managed mode.

    Note:

    This example shows a consume message operation. For a produce message operation, this page is different. See Section 8.4.1.5, "Produce Message Procedure" to see how this part of the procedure differs.

    After you enter the appropriate parameters, click Next.

  14. The Adapter Configuration Wizard - Messages page is displayed, as shown in Figure 8-10. The settings in this page define the correct schema for the message payload.

    You can perform one of the following:

    • Check Native format translation is not required (Schema is Opaque), which disables the rest of the fields.

    • Click Define Schema for Native Format to start the Native Format Builder wizard, which guides you through the process of defining the native format.

    • Enter the path for the schema file URL (or browse for the path).

    The following steps demonstrate the last option: browsing for the schema file URL.

    Figure 8-10 The Adapter Configuration Wizard - Messages Page

    Description of Figure 8-10 follows
    Description of "Figure 8-10 The Adapter Configuration Wizard - Messages Page"

  15. Click the Browse button.

    The Type Chooser dialog is displayed, with the Type Explorer navigation tree, as shown in Figure 8-11.

  16. Browse the tree and select the appropriate schema type, and then click OK.

    Figure 8-11 Selecting a Schema from the Type Chooser Dialog

    Description of Figure 8-11 follows
    Description of "Figure 8-11 Selecting a Schema from the Type Chooser Dialog"

    The Messages page is displayed again, this time with the Schema File URL field and the Schema Element field filled up, as shown in Figure 8-12.

    Figure 8-12 Completed Messages Dialog

    Description of Figure 8-12 follows
    Description of "Figure 8-12 Completed Messages Dialog"

  17. Click Next.

    The Finish page is displayed. This box shows the path and name of the adapter file that the wizard creates.

  18. Click Finish.

    The composite.xml page is displayed.

8.4.1.3 Generated Files

The following composite file is generated by the Adapter Configuration Wizard:

<composite name="AQQueue2Queue"           revision="1.0"           label="2007-09-04_11-58-50_914"           mode="active"           state="on"           xmlns="http://xmlns.oracle.com/sca/1.0"           xmlns:xs="http://www.w3.org/2001/XMLSchema"           xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"           xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy">
  <import namespace="http://xmlns.oracle.com/pcbpel/adapter/jms/Inbound/"          location="Inbound.wsdl" importType="wsdl"/>
  <import namespace="http://xmlns.oracle.com/pcbpel/adapter/jms/Outbound/"          location="Outbound.wsdl" importType="wsdl"/>
  <service name="Inbound">
    <interface.wsdl  interface="http://xmlns.oracle.com/pcbpel/adapter/jms/Inbound/#wsdl.interface (Consume_Message_ptt)"/>
    <binding.jca config="Inbound_jms.jca"/>
  </service>
  <component name="BPELProcess1">
    <implementation.bpel src="BPELProcess1.bpel"/>
  </component>
  <reference name="Outbound">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/jms/Outbound/#wsdl.interface (Produce_Message_ptt)"/>
    <binding.jca config="Outbound_jms.jca"/>
  </reference>
  <wire>
    <source.uri>Inbound</source.uri>
    <target.uri>BPELProcess1/Inbound</target.uri>
  </wire>
  <wire>
    <source.uri>BPELProcess1/Outbound</source.uri>
    <target.uri>Outbound</target.uri>
  </wire>
</composite>

The following code segment defines the name of the adapter and the locations of various necessary schemas and other definition files.

 <import namespace="http://xmlns.oracle.com/pcbpel/adapter/jms/Inbound/"          location="Inbound.wsdl" importType="wsdl"/>
  <import namespace="http://xmlns.oracle.com/pcbpel/adapter/jms/Outbound/"          location="Outbound.wsdl" importType="wsdl"/>

This code segment imports the necessary namespace.

<definitions name="Inbound" targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/jms/Inbound/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/jms/Inbound/" xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:imp1="http://xmlns.oracle.com/pcbpel/samples/expense">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://xmlns.oracle.com/pcbpel/samples/expense" schemaLocation="xsd/expense.xsd"/>
        </schema>
    </types>
    <message name="ExpenseRecord_msg">
        <part name="ExpenseRecord" element="imp1:ExpenseRecord"/>
    </message>
    <portType name="Consume_Message_ptt">
        <operation name="Consume_Message">
            <input message="tns:ExpenseRecord_msg"/>
        </operation>
    </portType>

This code segment defines the message type, name, and the port type for the partner link.

<adapter-config name="dequeue" adapter="Jms Adapter" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
  <connection-factory location="eis/wls/Queue" UIConnectionName="wls3"   UIJmsProvider="WLSJMS" adapterRef=""/>
  <endpoint-activation portType="Consume_Message_ptt" operation="Consume_Message">
    <activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
      <property name="DestinationName" value="jms/DemoInQueue"/>
      <property name="UseMessageListener" value="false"/>
      <property name="PayloadType" value="TextMessage"/>
    </activation-spec>
  </endpoint-activation>
</adapter-config>

8.4.1.4 weblogic-ra.xml file

The weblogic-ra.xml file defines the endpoints for the JMS connection factories. The connection factories include configuration properties for each endpoint. Endpoints are added to accommodate different types of connections, as demonstrated in the following sections. The following example is from the generic weblogic-ra.xml file:

<connection-instance>    
  <jndi-name>eis/wls/Queue</jndi-name>
    <connection-properties>
       <properties>
           <property>
               <name>ConnectionFactoryLocation</name>
               <value>weblogic.jms.XAConnectionFactory</value>
           </property>
           <property>
               <name>FactoryProperties</name>
               <value></value>
           </property>
           <property>
               <name>AcknowledgeMode</name>
               <value>AUTO_ACKNOWLEDGE</value>
           </property>
           <property>
              <name>IsTopic</name>
              <value>false</value>
           </property>
           <property>
               <name>IsTransacted</name>
               <value>false</value>
           </property>
           <property>
               <name>Username</name>
               <value></value>
           </property>
           <property>
               <name>Password</name>
               <value></value>
           </property>
           </properties>
      </connection-properties>
</connection-instance>

Note that you can also create a new connection by using the Oracle WebLogic Server Administration Console.

Creating a New Connection by Using the Oracle WebLogic Server Administration Console

The following are the steps for creating a new connection by using the Oracle WebLogic Server Administration Console:

  1. Navigate to the Oracle WebLogic Server Administration Console: http://servername:portnumber/console.

  2. Use the required credentials to open the Home page of the Oracle WebLogic Server Administration Console.

    The Home page of the Oracle WebLogic Server Administration Console is displayed.

  3. Select Deployments in the Domain Structure pane.

    The Oracle WebLogic Server Administration Console - Summary of Deployments page is displayed.

  4. Under Deployments, click any JMS adapter that you have deployed. For example, click JmsAdapter.

    The Oracle WebLogic Server Administration Console - Settings for JmsAdapter page is displayed.

  5. Click the Configuration tab, and then click the Outbound Connection Pools tab.

    The Outbound Connection Pool Configuration Table is displayed.

  6. Click Next.

    The Create a New Outbound Connection page is displayed.

  7. Select the default outbound connection group, and then click Next.

  8. Click Next.

  9. In the JNDI Name field, enter the JNDI name that you want to use to obtain the new connection instance. For example, eis/wls/Queue.

    Note that you can specify any name for the JNDI field. However, you must ensure that you use the same JNDI name while defining the consume or produce operation parameters in JDeveloper.

  10. Click Finish.

    The Save Deployment Plan Assistant page is displayed.

    The configuration changes that you made must be stored in a new deployment plan.

  11. In the Path field, select or enter the path of a deployment plan file. The path must end with '.xml'.

  12. Click OK.

    You have created a new connection. After you have done this, you must verify whether the properties you have created are correct.

  13. In the Settings for JmsAdapter page, click the Configuration tab, and then click the Properties tab.

    The connection that you created is listed in this page. Verify whether this value is correct. For example, if you are connecting to a third-party JMS server, then ensure that the Connection Factory Location field has the correct value applicable for a third-party JMS server.

    Note:

    In this example, you created a new connection for Oracle JMS Adapter by using the Oracle WebLogic Server Administration Console. To create connection for other adapters, you must follow the same steps. However, ensure that you select the appropriate adapter for which you want to create a connection in Step 4.
  14. Click Save.

8.4.1.4.1 Adding a Third-Party JMS Provider

You can specify that the adapter uses a third-party JMS Provider for non-Web Logic Server JMS and non-AQJMS connection instances, by supplying a value to the FactoryProperties parameter in the weblogic-ra.xml file. Specifically, you can provide the ThirdPartyJMSProvider value to the FactoryProperties parameter. This property is required only when you deploy an adapter to the WebLogic Server.

When this value is set to true, the JMS Adapter does not use DestinationAvailabilityListener for creating consumers for processing of JMS messages. The default is false. You must ensure you employ code similar to the following snippet:

<property>
    <name>FactoryProperties</name>
    <value>ThirdPartyJMSProvider=true</value>
</property> 

Note:

All pre-populated connection instances on a WebLogic Server reflect the change and consequently, no further tuning is required for those instances. Only when a new non WLS JMS or AQJMS provider access is required do you need to add new connection instance and therefore the ThirdPartyJMSProvider property.

8.4.1.5 Produce Message Procedure

A produce message operation has certain differences in the definition procedure, particularly in Step 13 of Section 8.4.1.2, "Using the Adapter Configuration Wizard to Configure Oracle JMS Adapter." Instead of specifying consume operation parameters, you specify the following produce operation parameters. This enables the adapter to produce (send) outbound messages for a JMS destination. The Produce Operation Parameters page is shown in Figure 8-13.

  • Destination Name:

    The JNDI name of the JMS queue or topic to which the message must be delivered. The name to enter is based on the type of JMS provider you use.

    For more information about destination name, see the following:

  • Message Body Type:

    The supported values are TextMessage, BytesMessage, and MapMessage. StreamMessage is not supported in this release.

  • Delivery Mode:

    The values are Persistent or Nonpersistent. A persistent delivery mode specifies a persistent JMS publisher; that is, a publisher that stores messages for later use by a durable subscriber. A durable subscriber is a consume message with a durable subscriber ID in the corresponding field in Step 15 of Section 8.4.1.2, "Using the Adapter Configuration Wizard to Configure Oracle JMS Adapter." A nondurable subscriber loses any messages that are produced when the adapter is not active. A durable subscriber downloads messages that have been stored in the persistent publisher, and therefore does not have to remain active at all time to receive all the messages.

  • Priority:

    Select a priority value, with 9 representing the highest priority and 0 representing the lowest priority. The default is 4.

  • TimeToLive:

    The amount of time before the message expires and is no longer available to be consumed.

Figure 8-13 Produce Operation Parameters Page

Description of Figure 8-13 follows
Description of "Figure 8-13 Produce Operation Parameters Page"

8.4.2 Configuring Oracle JMS Adapter with TIBCO JMS

This section describes how to configure Oracle JMS Adapter with Tibco JMS for direct connection and nondirect connection.

8.4.2.1 NonDirect Connection

Perform the following steps:

  1. Copy the following file to the <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib folder:

    • /<YOUR-TIBCO-INSTALL-LOCATION>/clients/java/tibjms.jar

  2. Configure the connector factory by modifying the weblogic-ra.xml file in AS11gR1SOA/soa/connectors/JmsAdapter.rar, as shown in the following example:

    <connection-instance>
              <jndi-name>eis/tibjms/Topic</jndi-name>
              <connection-properties>
                        <properties>
                                   <property>
                                            <name>ConnectionFactoryLocation</name>
                                            <value>TopicConnectionFactory</value>
                                   </property>
                                   <property>
                                            <name>FactoryProperties</name>
    <value>java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url=tibjmsnaming://<HOST>:<PORT>;java.naming.security.principal=<USERNAME>;java.naming.security.credentials=<PASSWORD></value>
                                   </property>
                                   <property>
                                            <name>AcknowledgeMode</name>
                                            <value>AUTO_ACKNOWLEDGE</value>
                                   </property>
                                   <property>
                                            <name>IsTopic</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>IsTransacted</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>Username</name>
                                            <value><USERNAME></value>
                                   </property>
                                   <property>
                                            <name>Password</name>
                                            <value><PASSWORD></value>
                                  </property>
                        </properties>
              </connection-properties>
    </connection-instance>
    <connection-instance>
              <jndi-name>eis/tibjms/Queue</jndi-name>
              <connection-properties>
                        <properties>
                                   <property>
                                            <name>ConnectionFactoryLocation</name>
                                            <value>QueueConnectionFactory</value>
                                   </property>
                                   <property>
                                            <name>FactoryProperties</name>
    <value>java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory;java.naming.provider.url=tibjmsnaming://<HOST>:<PORT>;java.naming.security.principal=<USERNAME>;java.naming.security.credentials=<PASSWORD></value>
                                   </property>
                                   <property>
                                            <name>AcknowledgeMode</name>
                                            <value>AUTO_ACKNOWLEDGE</value>
                                   </property>
                                   <property>
                                            <name>IsTopic</name>
                                            <value>false</value>
                                   </property>
                                   <property>
                                            <name>IsTransacted</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>Username</name>
                                            <value><USERNAME></value>
                                   </property>
                                   <property>
                                            <name>Password</name>
                                            <value><PASSWORD></value>
                                   </property>
                        </properties>
              </connection-properties>
    </connection-instance>
    

    Note that the default <USERNAME> and <PASSWORD> are admin and password, respectively.

    Alternatively, to configure a new connection factory by using the Oracle WebLogic Server Administration Console, use the steps mentioned in Section 2.19, "Adding an Adapter Connection Factory."

8.4.2.2 Direct Connection

Perform the following steps:

  1. Copy the following file to the <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib folder:

    • /<YOUR-TIBCO-INSTALL-LOCATION>/clients/java/tibjms.jar

  2. Configure the connector factory by modifying the weblogic-ra.xml file in AS11gR1SOA/soa/connectors/JmsAdapter.rar, as shown in the following example:

    <connection-instance>
              <jndi-name>eis/tibjmsDirect/Queue</jndi-name>
              <connection-properties>
                        <properties>
                                   <property>
                                            <name>ConnectionFactoryLocation</name>
                                            <value>com.tibco.tibjms.TibjmsQueueConnectionFactory</value>
                                   </property>
                                   <property>
                                            <name>FactoryProperties</name>
                                            <value>ServerUrl=tcp://<HOST>:<PORT>;UserName=<USERNAME>;UserPassword=<PASSWORD></value>
                                   </property>
                                   <property>
                                            <name>AcknowledgeMode</name>
                                            <value>AUTO_ACKNOWLEDGE</value>
                                   </property>
                                   <property>
                                            <name>IsTopic</name>
                                            <value>false</value>
                                   </property>
                                   <property>
                                            <name>IsTransacted</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>Username</name>
                                            <value><USERNAME></value>
                                   </property>
                                   <property>
                                            <name>Password</name>
                                            <value><PASSWORD></value>
                                   </property>
                        </properties>
              </connection-properties>
    </connection-instance>
    <connection-instance>
              <jndi-name>eis/tibjmsDirect/Topic</jndi-name>
              <connection-properties>
                        <properties>
                                    <property>
                                            <name>ConnectionFactoryLocation</name>
                                             <value>com.tibco.tibjms.TibjmsTopicConnectionFactory</value>
                                   </property>
                                   <property>
                                            <name>FactoryProperties</name>
                                            <value>ServerUrl=tcp://<HOST>:<PORT>;UserName=<USERNAME>;UserPassword=<PASSWORD></value>
                                   </property>
                                   <property>
                                            <name>AcknowledgeMode</name>
                                            <value>AUTO_ACKNOWLEDGE</value>
                                   </property>
                                   <property>
                                            <name>IsTopic</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>IsTransacted</name>
                                            <value>true</value>
                                   </property>
                                   <property>
                                            <name>Username</name>
                                            <value><USERNAME></value>
                                   </property>
                                   <property>
                                            <name>Password</name>
                                            <value><PASSWORD></value>
                                   </property>
                         </properties>
               </connection-properties>
    </connection-instance>
    

    Note that the default <USERNAME> and <PASSWORD> are admin and password, respectively.

    Alternatively, to configure a new connection factory by using the Oracle WebLogic Server Administration Console, use the steps mentioned in Section 2.19, "Adding an Adapter Connection Factory."

8.4.3 Configuring Oracle JMS Adapter with IBM WebSphere MQ JMS

This section describes how to configure Oracle JMS Adapter with IBM WebSphere MQ JMS for non-XA and XA data sources.

8.4.3.1 Non-XA Data Sources

Perform the following steps:

  1. Copy the following files to the <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib folder:

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/com.ibm.mq.jar

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/com.ibm.mqjms.jar

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/dhbcore.jar

  2. Configure the connector factory by modifying the weblogic-ra.xml file in AS11gR1SOA/soa/connectors/JmsAdapter.rar, as shown in the following example:

    <connection-instance>
    <jndi-name>eis/webspheremq/Queue</jndi-name>
       <connection-properties>
          <properties>
             <property>
               <name>ConnectionFactoryLocation</name>
               <value>com.ibm.mq.jms.MQQueueConnectionFactory</value>
             </property>
             <property>
                <name>FactoryProperties</name>
                <value>QueueManager=<QUEUEMANAGER>;TransportType=1;HostName= <YOUR-HOST>;Port=<YOUR-PORT>;Channel=<CHANNEL>;ThirdPartyJMSProvider=true            </value>
              </property>
              <property>
                  <name>AcknowledgeMode</name>
                  <value>AUTO_ACKNOWLEDGE</value>
              </property>
              <property>
                 <name>IsTopic</name>
                 <value>false</value>
              </property>
              <property>
                 <name>IsTransacted</name>
                 <value>true</value>
             </property>
             <property>
                 <name>Username</name>
                 <value><USERNAME></value>
             </property>
             <property>
                <name>Password</name>
                <value><PASSWORD></value>
            </property>
            </properties>
        </connection-properties>
    </connection-instance>
    

    Note that the default <USERNAME> and <PASSWORD> are MUSR_MQADMIN and password, respectively.

    Alternatively, to configure a new connection factory by using the Oracle WebLogic Server Administration Console, use the steps mentioned in Section 2.19, "Adding an Adapter Connection Factory."

8.4.3.2 XA Data Sources

Perform the following steps:

  1. Copy the following files to the <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib folder:

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/com.ibm.mq.jar

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/com.ibm.mqjms.jar

    • /<YOUR-MQSERIES-INSTALL-LOCATION>/java/lib/dhbcore.jar

    • com.ibm.mqetclient.jar

      This is an IBM-extended transactional client, which is an optional component that requires separate licensing.

  2. Configure the connector factory by modifying the weblogic-ra.xml file in AS11gR1SOA/soa/connectors/JmsAdapter.rar, as shown in the following example:

    <connection-instance>
    <jndi-name>eis/webspheremq/Queue</jndi-name>
       <connection-properties>
            <properties>
               <property>
                  <name>ConnectionFactoryLocation</name>
                  <value>com.ibm.mq.jms.MQXAQueueConnectionFactory</value>
               </property>
               <property>
                  <name>FactoryProperties</name>
                  <value>QueueManager=<QUEUEMANAGER>;TransportType=1; HostName=<YOUR-HOST>;Port=<YOUR-PORT>;Channel=<CHANNEL>;               ThirdPartyJMSProvider=true</value>
               </property
               <property>
                 <name>AcknowledgeMode</name>
                 <value>AUTO_ACKNOWLEDGE</value>
               </property>
               <property>
                 <name>IsTopic</name>
                 <value>false</value>
               </property
               <property>
                  <name>IsTransacted</name
                  <value>false</value>
               </property
               <property>
                  <name>Username</name>
                  <value><USERNAME></value>
               </property>
               <property>
                  <name>Password</name>
                  <value><PASSWORD></value>
                </property>
             </properties>
        </connection-properties>
    </connection-instance>
    

    Note that the default <USERNAME> and <PASSWORD> are MUSR_MQADMIN and password, respectively.

    Alternatively, to configure a new connection factory by using the Oracle WebLogic Server Administration Console, use the steps mentioned in Section 2.19, "Adding an Adapter Connection Factory."

8.4.4 Configuring Oracle JMS Adapter with Active MQ JMS

This section describes how to configure Oracle JMS Adapter with Active MQ JMS.

Perform the following steps:Copy the following files to the <SOAInstall_DIR>/user_projects/domains/<DOMAIN_NAME>/lib folder:

  • /<YOUR-ACTIVEMQ-INSTALL-LOCATION>//activemq-core-4.1.1.jar

  • /<YOUR-ACTIVEMQ-INSTALL-LOCATION>//backport-util-concurrent-2.1.jar

  • /<YOUR-ACTIVEMQ-INSTALL-LOCATION>//activeio-core-3.0.0-incubator.jar

  • /<YOUR-ACTIVEMQ-INSTALL-LOCATION>//commons-logging-1.1.jar

Configure the connector factory by modifying the weblogic-ra.xml file in AS11gR1SOA/soa/connectors/JmsAdapter.rar as shown in the following example:


<connection-instance>
      <jndi-name>eis/activemq/Queue</jndi-name>
      <connection-properties>
      <properties>
            <property>
                  <name>ConnectionFactoryLocation</name>
                  <value>org.apache.activemq.ActiveMQConnectionFactory</value>
            </property>
            <property>
                  <name>FactoryProperties</name>
                  <value>BrokerURL=tcp://<YOUR-HOST>:<YOUR-PORT></value>
            </property>
            <property>
                  <name>AcknowledgeMode</name>
                  <value>AUTO_ACKNOWLEDGE</value>
            </property>
            <property>
                  <name>IsTopic</name>
                  <value>false</value>
            </property>
            <property>
                  <name>IsTransacted</name>
                   <value>true</value>
            </property>
            <property>
                  <name>Username</name>
                  <value></value>
           </property>
           <property>
                 <name>Password</name>
                 <value></value>
            </property>
      </properties>
      </connection-properties>
</connection-instance>

Alternatively, to configure a new connection factory by using the Oracle WebLogic Server Administration Console, use the steps mentioned in Section 2.19, "Adding an Adapter Connection Factory".

8.4.5 WLS JMS Text Message

This WLS JMS text message use case for Oracle BPEL PM demonstrates how the Oracle JMS Adapter dequeues from and enqueues to the WLS JMS Queue.

In the case of a WLS JMS text message scenario for a Mediator business process, you need the following files from the artifacts.zip file contained in the adapters-jms-101-wlsjms-textmessageusingqueues sample:

  • artifacts/schemas/expense.xsd

You can obtain the adapters-jms-101-wlsjms-textmessageusingqueues sample by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

This section includes the following topics:

8.4.5.1 Meeting Prerequisites

You must perform the following prerequisite for the WLS JMS text message use case for Oracle BPEL PM:

8.4.5.1.1 Creating Queues in the Oracle WebLogic Server Administration Console

Perform the following steps to create queues required for this use case:

  1. Navigate to the Oracle WebLogic Server Administration Console: http://servername:portnumber/console

  2. Use the required credentials to open the Home page of the Oracle WebLogic Server Administration Console.

    The Home page of the Oracle WebLogic Server Administration Console is displayed, as shown in Figure 8-14.

    Figure 8-14 The Oracle WebLogic Server Administration Console Home Page

    Description of Figure 8-14 follows
    Description of "Figure 8-14 The Oracle WebLogic Server Administration Console Home Page"

  3. Navigate to Services, Messaging, JMS Modules in the Domain Structure pane.

    The Oracle WebLogic Server Administration Console - JMS Modules page is displayed.

  4. Click one of the existing modules. In this example, click SOAJMSModule.

    The Oracle WebLogic Server Administration Console - Settings for SOAJMSModule page is displayed.

  5. Under the Summary of Resources section, click New.

    The Oracle WebLogic Server Administration Console - Create a New JMS System Module Resource page is displayed.

  6. Select Queue, and then click Next.

  7. Enter the following queue details:

    • Name

    • JNDI Name

    • Template

  8. Click Next.

  9. Select the subdeployment you want to use from the Subdeployments list.

  10. Click Finish.

    You have created the queue, ReceiveQueue.

  11. Repeat steps 1 through 10, and create a queue named SendQueue.

8.4.5.1.2 Creating the Q2Qorders.xsd file

You need to create the Q2Qorders.xsd file by using the following code:

<?xml version="1.0" ?>
 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            targetNamespace="http://xmlns.oracle.com/pcbpel/nxsd/extensions/FileInbound"
            xmlns:tns="http://xmlns.oracle.com/pcbpel/nxsd/extensions/FileInbound"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified" nxsd:encoding="US-ASCII" nxsd:stream="chars" nxsd:version="NXSD">
  <xsd:element name="Items">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Name" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="Type" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="Quantity" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
              </xsd:element>
              <xsd:element name="Rate" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
<!--NXSDWIZ:C:\errors\inputFiles\orders.txt:-->

8.4.5.2 Creating an Application Server Connection

You must establish connectivity between the design-time environment and the server you want to deploy to. Perform the steps mentioned in Section 2.7, "Creating an Application Server Connection for Oracle JCA Adapters" to create an application server connection.

8.4.5.3 Creating an Application and an SOA Project

You must create an JDeveloper application to contain the SOA composite. Use the following steps to create a new application and an SOA project:

  1. Open JDeveloper.

  2. In the Application Navigator, click New Application. The Create Generic Application - Name your Application dialog is displayed.

  3. Enter a name for the application in the Application Name field. For example, queue2queue.

  4. In the Application Template list, choose Generic Application.

  5. Click Next.

    The Name your project page is displayed.

  6. In the Project Name field, enter a descriptive name. For example, queue2queue.

  7. In the Available list in the Project Technologies tab, double-click SOA to move it to the Selected list.

  8. Click Next. The Create Generic Application - Configure SOA settings page is displayed.

  9. Select Composite With BPEL from the Composite Template list, and then click Finish.

    You have created a new application, and an SOA project.

    The Create BPEL Process page is displayed.

  10. Enter a name for the BPEL process in the Name field. For example, queue2queue.

  11. Select Define Interface Later in the Template list, and then click OK.

    You have created a BPEL process.

    The queue2queue application, queue2queue project, and the SOA composite appear in the design area.

  12. Copy the Q2Qorders.xsd file to the XSD folder in your project.

8.4.5.4 Creating an Inbound Adapter Service

Perform the following steps to create an adapter service that will dequeue the message to a queue:

  1. Drag and drop JMS Adapter from the Service Adapters list to the Exposed Services swim lane in the composite.xml page.

    The Adapter Configuration Wizard Welcome page is displayed.

  2. Click Next.

    The Service Name page is displayed.

  3. Enter Inbound in the Service Name field, and click OK.

    The JMS Provider page is displayed.

  4. Select Oracle Weblogic JMS in the Oracle Enterprise Messaging Service (OEMS) box, as shown in Figure 8-15, and click Next. The Service Connection page is displayed.

    Figure 8-15 The Adapter Configuration Wizard JMS Provider Page

    Description of Figure 8-15 follows
    Description of "Figure 8-15 The Adapter Configuration Wizard JMS Provider Page"

  5. Select the connection created in Section 8.4.5.2, "Creating an Application Server Connection," as shown in Figure 8-16.

    Figure 8-16 The Adapter Configuration Wizard Service Connection Page

    Description of Figure 8-16 follows
    Description of "Figure 8-16 The Adapter Configuration Wizard Service Connection Page"

  6. Click Next. The Adapter Interface page is displayed.

  7. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  8. Select Consume Message, as shown in Figure 8-17, and click Next.

    The Consume Operation Parameters page is displayed.

    Figure 8-17 The Adapter Configuration Wizard Operation Page

    Description of Figure 8-17 follows
    Description of "Figure 8-17 The Adapter Configuration Wizard Operation Page"

  9. Click Browse and select ReceiveQueue in the Destination field.

    The Consume Operation Parameters page is displayed.

  10. Enter the parameters for the consume operation, and then click Next.

    The Messages page is displayed.

    Note:

    The value specified in the JNDI name should exist in the Oracle JMS Adapter weblogic-ra.xml file to ensure that the adapter runs in managed mode.
  11. Click Browse at the end of the URL field.

    The Type Chooser dialog is displayed.

  12. Select Project Schema Files, Q2Qorders.xsd, and Items, as shown in Figure 8-18.

    Figure 8-18 The Type Chooser Dialog

    Description of Figure 8-18 follows
    Description of "Figure 8-18 The Type Chooser Dialog"

  13. Click Next. The Q2Qorders.xsd schema file is displayed in the URL in the Messages page, as shown in Figure 8-19.

    Figure 8-19 The Adapter Configuration Wizard - Message Page

    Description of Figure 8-19 follows
    Description of "Figure 8-19 The Adapter Configuration Wizard - Message Page"

  14. Click Next. The Finish page is displayed.

  15. Click Finish. You have configured a JMS inbound adapter service.

8.4.5.5 Creating an Outbound Adapter Service

Perform the following steps to create an adapter service to enqueue the request messages and dequeue the corresponding response messages (report) from a queue:

  1. Drag and drop JMS Adapter from the Component Palette into the Exposed Services swim lane. The Adapter Configuration Wizard Welcome page is displayed.

  2. Click Next. The Service Name page is displayed.

  3. Enter Outbound in the Service Name field, and click OK. The JMS Provider page is displayed.

  4. Select Oracle Weblogic JMS in the Oracle Enterprise Messaging Service (OEMS) box, and click Next. The Service Connection page is displayed.

  5. Select the connection created in Section 8.4.5.2, "Creating an Application Server Connection," and click Next. The Adapter Interface page is displayed.

  6. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  7. Select Produce Message, and click Next. The Produce Operation Parameters page is displayed.

  8. Click Browse and select SendQueue in the Destination field. The Produce Operation Parameters page is displayed.

  9. Click Next. The Messages page is displayed.

  10. Click Browse at the end of the URL field. The Type Chooser dialog is displayed.

  11. Select Project Schema Files, Q2Qorders.xsd, and Items.

  12. Click Next. The Q2Qorders.xsd schema file is displayed in the URL in the Message dialog.

  13. Click Next. The Finish page is displayed.

  14. Click Finish. You have configured the JMS adapter service, and the composite.xml page is displayed.

8.4.5.6 Wiring Services and Activities

You must wire the three components that you have created, Inbound adapter service, BPEL process, and Outbound adapter reference. Perform the following steps to wire components together:

  1. Drag the small triangle in the inbound Oracle JMS Adapter component in the Exposed Services area to the drop zone that appears as a green triangle in the BPEL process in the Components area.

  2. Drag the small triangle in the BPEL process in the Components area to the drop zone that appears as a green triangle in the outbound Oracle JMS Adapter in the External References area.

    The JDeveloper Composite.xml is displayed, as shown in Figure 8-20.

    Figure 8-20 The JDeveloper - Composite.xml

    Description of Figure 8-20 follows
    Description of "Figure 8-20 The JDeveloper - Composite.xml"

  3. Click File, Save All.

  4. Double-click queue2queue.

    The queue2queue.bpel page is displayed.

  5. Drag and drop the Receive, Assign, and Invoke activities in the order mentioned from the Component Palette to the Components area, as shown in Figure 8-21.

    Figure 8-21 The queue2queue.bpel Page

    Description of Figure 8-21 follows
    Description of "Figure 8-21 The queue2queue.bpel Page"

  6. Double-click Receive.

    The Receive dialog is displayed.

  7. Click the Browse Partner Links icon at the end of the Partner Link field.

    The Partner Link Chooser dialog is displayed.

  8. Select Inbound, and then click OK.

    The Receive dialog is displayed with the Partner Link field populated with the value Inbound.

  9. Click the Auto-Create Variable icon that is displayed at the end of the Variable field.

    The Create Variable dialog is displayed.

  10. Accept the defaults, and click OK.

  11. Select the Create Instance box, as shown in Figure 8-22, and click OK.

    Figure 8-22 The Receive Dialog

    Description of Figure 8-22 follows
    Description of "Figure 8-22 The Receive Dialog"

  12. Double-click the Invoke activity.

    The Invoke dialog is displayed.

  13. Click the Browse Partner Links icon at the end of the Partner Link field.

    The Partner Link Chooser dialog is displayed.

  14. Select Outbound, and then click OK.

    The Invoke dialog is displayed with the Partner Link field populated with the value Outbound.

  15. Click the Automatically Create Input Variable icon that is displayed at the end of the Input Variable field.

    The Create Variable dialog is displayed.

  16. Accept the defaults, and click OK.

    The Invoke dialog is displayed, as shown in Figure 8-23.

    Figure 8-23 The Invoke Dialog

    Description of Figure 8-23 follows
    Description of "Figure 8-23 The Invoke Dialog"

  17. Click OK.

  18. Double-click the Assign activity.

    The Assign dialog is displayed.

  19. Click the plus icon, and select Copy Operation. The Create Copy Operation dialog is displayed.

  20. Select the variables, as shown in Figure 8-24, and click OK.

    Figure 8-24 The Create Copy Operation Dialog

    Description of Figure 8-24 follows
    Description of "Figure 8-24 The Create Copy Operation Dialog"

  21. Click OK in the Assign dialog.

  22. Click File, Save All.

8.4.5.7 Deploying with JDeveloper

You must deploy the application profile for the SOA project and the application you created in the preceding steps. To deploy the application profile using JDeveloper, use the following steps:

  1. Create an application server connection by using the procedure described in Chapter 2, "Creating an Application Server Connection for Oracle JCA Adapters."

  2. Deploy the application by using the procedure described in Section 2.8, "Deploying Oracle JCA Adapter Applications from JDeveloper."

8.4.5.8 Monitoring Using the Fusion Middleware Control Console

You can monitor the deployed composite by using the Fusion Middleware Control Console. Perform the following steps:

  1. Navigate to http://servername:portnumber/em.

    The composite you deployed is displayed in the Application Navigator.

  2. In the Last 5 Instances pane, there is an entry of a new instance. This is the instance that was triggered when you enqueued a message using queue2queue.java.

  3. Click one of the instances. The Flow Trace page is displayed.

  4. Click the TextMessage component instance. The Audit page is displayed.

  5. Click the Flow-Debug tab to debug the instance.

8.4.6 Accessing Queues and Topics from WLS JMS Server in a Remote Oracle WebLogic Server Domain

Oracle JMS Adapter can be used to access remote WLS JMS destinations. Remote destinations refer to queues or topics that are defined in a WLS JMS server, which is part of a remote Oracle WebLogic Server domain.

In order to do so, ensure that you use the connector factory configured to interact to the remote WLS JMS server. You can achieve this by setting the <FactoryProperties> property of the connector factory defined in weblogic-ra.xml to remote server configuration, as shown in the following example:

<property>
<name>FactoryProperties</name>
<value>java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory; java.naming.provider.url= t3://<HOST>:<PORT>;java.naming.security.principal= <USERNAME>;java.naming.security.credentials=<PASSWORD>
</value>
</property>

To enable Oracle JMS Adapter to read from a remote queue that is present in a remote WLS JMS server, you must configure the following:

  1. You must have a unique domain name and JMS server name in both the servers.

  2. You must enable global trust between the two servers.

    Refer to the following link for information about how to enable global trust between servers:

    http://download.oracle.com/docs/cd/E13222_01/wls/docs100/ConsoleHelp/taskhelp/security/EnableGlobalTrustBetweenDomains.html

    This configuration is appropriate when you connect to queues or topics present in WLS9.2 server.

8.4.6.1 JMS Adapter Limitations When a Remote Server is Used

The JMS Adapter enables you to interact with WebLogic Server JMS destination locations in a domain that are remote to the WebLogicServer domain where SOA is installed.

Two options are supported that enable you to access remote destinations via the JMS adapter:

  • Direct access via specification of the FactoryProperties property in the weblogic-ra.xml file, with access parameters indicating the remote domain.

  • Configuring the foreign server to access the remote domain.

For inbound use cases, both options are supported. For outbound use cases only, direct access is supported, but configuring the foreign server is not supported.

8.4.7 Synchronous/Asynchronous Request Reply Interaction Pattern

Oracle JMS Adapter supports both synchronous and asynchronous request reply interaction pattern.

8.4.7.1 Synchronous Request Reply Pattern

You can use the Adapter Configuration Wizard to model a process that will allow Oracle JMS Adapter to be used in a synchronous request reply interaction pattern. In this case, the Oracle JMS Adapter sends a request to the request queue and waits for a response from the reply queue before further execution continues. Underneath, the Oracle JMS Adapter uses a new interaction pattern JmsRequestReplyInteractionSpec. This interaction spec allows for a request and reply destination name to be configured.

A variation, new to 11g Release 1 (11.1.1.4.0), allows usage of temporary destination as part of the reply queue. Basically, this pattern allows an Oracle JMS Adapter to send a message to a JMS destination. In turn, the adapter will set the JMSReplyTo header to the reply destination. This value is then used by a third party client to send the message to the reply destination which is then dequeued by the Oracle JMS Adapter.

When using the Oracle JMS Adapter in a synchronous pattern ensure that you use a non-XA connection factory and set the connector factory isTransacted property to true in weblogic-ra.xml.

When you use the Oracle JMS Adapter in a synchronous pattern with Oracle WebLogic Server JMS, the connection factory must be weblogic.jms.ConnectionFactory or any other non-XA connection factory.

For more information, you can obtain the following samples by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

  • adapters-jms-106-wlsjms-syncrequestreply

  • adapters-jms-107-wlsjms-syncrequestreplywithtemporaryreplydestination

8.4.7.2 Asynchronous Request Reply Pattern

You can use the Adapter Configuration Wizard to model a process that allows Oracle JMS Adapter to be used in an asynchronous request reply interaction pattern.

Basically this pattern allows an Oracle JMS Adapter to send a message to a JMS destination. When a message is received on the reply queue, the Oracle JMS Adapter is able to route message to the correct composite or the component instance. The correlation is done based on the JMSMessageID of the request message, which becomes the JMSCorrelationID of the reply message, and the conversation ID of the underlying component.

For more information, you can obtain the following samples by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

  • adapters-jms-105-wlsjms-nativecorrelation

8.4.8 AQ JMS Text Message

This use case demonstrates how the Oracle JMS Adapter dequeues from and enqueues to the AQ JMS Queue.

You can obtain the adapters-jms-108-aqjms-textmessageusingqueues sample by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

This section includes the following topics:

8.4.8.1 Meeting Prerequisites

You must perform the following prerequisites to complete this use case:

8.4.8.1.1 Configuring AQ JMS in Oracle WebLogic Server Administration Console

To configure AQ JMS in Oracle WebLogic Server Administration Console, you must perform the following steps:

Adding an Oracle WebLogic JMS Module

Note that adding an Oracle WebLogic JMS module is optional. You can also create an AQJMS foreign server in a preexisting JMS module.

  1. Navigate to the Oracle WebLogic Server Administration Console: http://servername:portnumber/console.

  2. Use the required credentials to open the Home page of the Oracle WebLogic Server Administration Console.

    The Home page of the Oracle WebLogic Server Administration Console is displayed.

  3. Navigate to Services, Messaging, JMS Modules in the Domain Structure pane.

    The Oracle WebLogic Server Administration Console - JMS Modules page is displayed.

  4. Click New to create a new WebLogic JMS module.

    The Oracle WebLogic Server Administration Console - Create JMS System Module page is displayed.

  5. Enter a name for the JMS module, and then click Next.

    The Oracle WebLogic Server Administration Console - Create JMS System Module page is displayed.

  6. Select a target server where your SOA component is running, and then click Next.

    The Oracle WebLogic Server Administration Console - Create JMS System Module page is displayed.

  7. Click Finish.

    You have created a JMS module.

Adding an AQJMS Foreign Server to the JMS Module

The next step is to add an AQ JMS foreign server to the JMS module by performing the following:

  1. Click the JMS module that you created.

    The Oracle WebLogic Server Administration Console - Settings for AQJMSModule page is displayed.

  2. Click New in the Summary of Resources table to create a new JMS system module resource.

    The Oracle WebLogic Server Administration Console - Create a New JMS System Module Resource page is displayed.

  3. Under Choose the type of resource you want to create, select Foreign Server, and then click Next.

    The Oracle WebLogic Server Administration Console - Create a New JMS System Module Resource page is displayed.

  4. In the Name field, enter a name for the foreign server, and then click Finish.

    The Oracle WebLogic Server Administration Console - Settings for <JMS Module Name> page is displayed.

Configuring the AQJMS Foreign Server

The next step is to configure the AQJMS foreign server that you created:

  1. Click the AQ JMS Foreign Server listed under the Summary of Resources table.

    The Oracle WebLogic Server Administration Console - Settings for TestAQJMS_ForeignServer page is displayed.

  2. Enter the following values:

    • JNDI Initial Context Factory: oracle.jms.AQjmsInitialContextFactory

      If the AQJMS Foreign Server is used by the WebLogic server side components, then you must configure a data source with this AQ JMS Foreign Server, by specifying the following values:

      In the JNDI Properties field, enter datasource=<datasource jndi location>. Replace the place holder with the JNDI location of your data source.

      However, if the AQJMS Foreign Server is used by WebLogic application client, then you must configure the JDBC URL with the AQ JMS foreign server you created.

    • JNDI Connection URL: Specify the URL that WebLogic Server will use to contact the JNDI provider.

      This value is required only if the AQJMS foreign server is used by the WebLogic application client.

    • JNDI Properties Credential: Specify any Credentials that must be set for the JNDI provider.

      This value is required only if the AQJMS foreign server is used by the Weblogic application client.

Note:

If you want to use RAC database as adapter endpoint, then the datasource pointed by the JNDI property, mentioned in the preceding step, must point to a multi data source.

Individual data sources and multi data sources used for such endpoints must use the recommended setting listed in Section 2.21, "Recommended Setting for Data Sources Used by Oracle JCA Adapters."

Adding Connection Factories to the AQ JMS Foreign Server

To add connection factories to the AQJMS foreign server:

  1. In the Connection Factories tab in the Settings for <Foreign Server Name> page, click the AQJMS foreign server that you created.

  2. Click New.

    The Oracle WebLogic Server Administration Console - Create a New Foreign JMS Connection Factory page is displayed.

  3. In the Name field, enter a name for this connection factory. This is a logical name that would be referenced by Oracle WebLogic Server.

  4. In the Local JNDI Name field, enter the local JNDI name that you would use in your application to look up this connection factory.

    Note:

    Ensure that you specify aqjms/XAQueueConnectionFactory for local JNDI name if you are connecting to a queue with JNDI name eis/aqjms/Queue that is provided with the sample use case, AQQueuetoQueue.

    Else, specify aqjms/XATopicConnectionFactory if you are connecting to a topic with JNDI name eis/aqjms/Topic.

  5. In the Remote JNDI Name field, enter one of the following values depending on your requirement. If you use this connection factory in a global transaction, then use an XA-based connection factory, else use non-XA based connection factory.

    • QueueConnectionFactory

    • TopicConnectionFactory

    • ConnectionFactory

    • XAQueueConnectionFactory

    • XATopicConnectionFactory

    • XAConnectionFactory

  6. Click OK.

Adding Destinations to the AQJMS Foreign Server

To add destinations to the AQJMS foreign server:

  1. Click the Destinations tab in the Settings for <Foreign Server Name> page.

  2. Click New and specify a name for this destination. This is a logical name that will be referenced by the Oracle WebLogic Server and has nothing to do with the destination name.

  3. In the Local JNDI Name field, enter the local JNDI name you would use in your application to look up this destination.

  4. In the Remote JNDI Name field, enter Queues/<queue name>if the destination is a queue, or enter Topics/<topic name> if the destination is a topic.

  5. Click OK.

  6. Restart the Oracle WebLogic Server Administration Console.

You have configured AQJMS in an Oracle WebLogic Server.

8.4.8.1.2 Creating Queues in Oracle Database

To create queues:

  1. Run the setup_user.sql script.

  2. Run the create_start_queues.sql script.

These scripts are located in the adapters-jms-108-aqjms-textmessageusingqueues sample artifacts/sql directory. You can obtain the adapters-jms-108-aqjms-textmessageusingqueues sample by accessing the Oracle SOA Sample Code site, and selecting the Adapters tab.

8.4.8.2 Create an Application Server Connection

You must establish connectivity between the design-time environment and the server you want to deploy to. Perform the steps mentioned in Section 2.7, "Creating an Application Server Connection for Oracle JCA Adapters" to create an application server connection.

8.4.8.3 Creating an Application and an SOA Project

You must create an JDeveloper application to contain the SOA composite. Use the following steps to create a new application and an SOA project:

  1. Open JDeveloper.

  2. In the Application Navigator, click New Application. The Create Generic Application - Name your Application dialog is displayed.

  3. Enter a name for the application in the Application Name field. For example, AQQueue2Queue.

  4. In the Application Template list, choose Generic Application.

  5. Click Next.

    The Name your project page is displayed.

  6. In the Project Name field, enter a descriptive name. For example, AQQueue2Queue.

  7. In the Available list in the Project Technologies tab, double-click SOA to move it to the Selected list.

  8. Click Next. The Create Generic Application - Configure SOA Settings page is displayed.

  9. Select Composite With BPEL from the Composite Template list, and then click Finish.

    You have created a new application and an SOA project.

    The Create BPEL Process page is displayed.

  10. Enter a name for the BPEL process in the Name field.

  11. Select Define Interface Later in the Template list, and then click OK.

    You have created a BPEL process.

    The AQQueue2Queue application, the AQQueue2Queue project, and the SOA composite appear in the design area.

  12. Copy the expense.xsd file to the XSD folder in your project.

    This file is located in the adapters-jms-108-aqjms-textmessageusingqueues sample artifacts/schemas directory. You can obtain the adapters-jms-108-aqjms-textmessageusingqueues sample by accesing the Oracle SOA Sample Code site, and selecting the Adapters tab.

8.4.8.4 Creating an Inbound Adapter Service

Perform the following steps to create an adapter service to dequeue the message to a queue:

  1. Drag and drop JMS Adapter from the Service Adapters list to the Exposed Services swim lane in the composite.xml page. The Adapter Configuration Wizard Welcome page is displayed.

  2. Click Next. The Service Name page is displayed.

  3. Enter Inbound in the Service Name field, and click OK. The JMS Provider page is displayed.

  4. Select Oracle Advanced Queueing in the Oracle Enterprise Messaging Service (OEMS) box, and click Next. The Service Connection page is displayed.

  5. Select the connection created in Section 8.4.5.2, "Creating an Application Server Connection."

  6. Click Next. The Adapter Interface page is displayed.

  7. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  8. Select Consume Message, and click Next. The Consume Operation Parameters page is displayed.

  9. Click Browse and select testInQueue in the Destination field.

  10. Click Next. The Messages page is displayed.

  11. Click Browse at the end of the URL field. The Type Chooser dialog is displayed.

  12. Select Project Schema Files, expense.xsd.

  13. Click Next. The expenses.xsd schema file is displayed in the URL field in the Messages page.

  14. Click Next. The Finish page is displayed.

  15. Click Finish. You have configured a JMS inbound adapter service.

8.4.8.5 Creating an Outbound Adapter Service

Perform the following steps to create an adapter service that will enqueue the request messages and dequeue the corresponding response messages (report) from a queue:

  1. Drag and drop JMS Adapter from the Component Palette into the Exposed Services swim lane. The Adapter Configuration Wizard Welcome page is displayed.

  2. Click Next. The Service Name page is displayed.

  3. Enter Outbound in the Service Name field, and click OK. The JMS Provider page is displayed.

  4. Select Oracle Advanced Queueing in the Oracle Enterprise Messaging Service (OEMS) box, and click Next. The Service Connection page is displayed.

  5. Select the connection created in Section 8.4.5.2, "Creating an Application Server Connection," and click Next. The Adapter Interface page is displayed.

  6. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  7. Select Produce Message, and click Next. The Produce Operation Parameters page is displayed.

  8. Click Browse and select testOutQueue in the Destination field. The Produce Operation Parameters page is displayed.

  9. Click Next. The Messages page is displayed.

  10. Click Browse at the end of the URL field. The Type Chooser dialog is displayed.

  11. Select Project Schema Files, expense.xsd.

  12. Click Next. The expense.xsd schema file is displayed in the URL field in the Message dialog.

  13. Click Next. The Finish page is displayed.

  14. Click Finish. You have configured the JMS adapter service, and the composite.xml page is displayed.

8.4.8.6 Wiring Services and Activities

You must wire the three components that you have created: Inbound adapter service, BPEL process, and Outbound adapter reference. Perform the following steps to wire the components together:

  1. Drag the small triangle in the inbound Oracle JMS Adapter component in the Exposed Services area to the drop zone that appears as a green triangle in the BPEL process in the Components area.

  2. Drag the small triangle in the BPEL process in the Components area to the drop zone that appears as a green triangle in the outbound Oracle JMS Adapter in the External References area.

    The JDeveloper Composite.xml is displayed, as shown in Figure 8-25.

    Figure 8-25 JDeveloper - Composite.xml

    Description of Figure 8-25 follows
    Description of "Figure 8-25 JDeveloper - Composite.xml"

  3. Click File, Save All.

  4. Double-click the BPEL process. The BPELProcess1.bpel page is displayed.

  5. Drag and drop the Receive, Assign, and Invoke activities, in the order mentioned, from the Component Palette to the Components area.

  6. Double-click the Receive activity.

    The Receive dialog is displayed.

  7. Click the Browse Partner Links icon at the end of the Partner Link field.

    The Partner Link Chooser dialog is displayed.

  8. Select Inbound, and then click OK.

    The Receive dialog is displayed with the Partner Link field populated with the value Outbound.

  9. Click the Auto-Create Variable icon that is displayed at the end of the Variable field. The Create Variable dialog is displayed.

  10. Accept the defaults, and click OK.

  11. Check the Create Instance box.

  12. Double-click the Invoke activity to Outbound.

    The Invoke dialog is displayed.

  13. Click the Automatically Create Input Variable icon that is displayed at the end of the Input Variable field.

  14. Click the Browse Partner Links icon at the end of the Partner Link field.

    The Partner Link Chooser dialog is displayed.

  15. Select Outbound, and then click OK.

    The Invoke dialog is displayed with the Partner Link field populated with the value Outbound.

  16. Accept the defaults, and click OK.

  17. Click OK.

  18. Double-click the Assign activity.

    The Assign dialog is displayed.

  19. Click the plus icon, and select Copy Operation.

    The Create Copy Operation dialog is displayed.

  20. Select the variables, and click OK.

  21. Click OK in the Assign dialog.

  22. Click File, Save All.

Note:

When using Oracle JMS Adapter to dequeue from AQ JMS Topics with durable subscriptions, if you notice that the dequeue operation exhibits slow performance, then you can speed up the entire performance by using multiple inbound threads for each adapter service.

Oracle JMS Adapter allows multiple inbound threads if you specify an endpoint property adapter.jms.receive.threads.

However, note that this workaround is not applicable when using non-durable subscriptions because doing so will result in duplicate messages.

8.4.8.7 Deploying with JDeveloper

You must deploy the application profile for the SOA project and the application you created in the preceding steps. To deploy the application profile by using JDeveloper, perform the following steps:

  1. Create an application server connection by using the procedure described in Chapter 2, "Creating an Application Server Connection for Oracle JCA Adapters."

  2. Deploy the application by using the procedure described in Section 2.8, "Deploying Oracle JCA Adapter Applications from JDeveloper."

8.4.8.8 Monitoring Using the Fusion Middleware Control Console

You can monitor the deployed composite by using the Fusion Middleware Control Console. Perform the following steps:

  1. Navigate to http://servername:portnumber/em. The composite you deployed is displayed in the Application Navigator.

  2. In the Last 5 Instances pane, there is an entry of a new instance. This is the instance that was triggered when you enqueued a message by using AQQueue2Queue.java.

  3. Click one of the instances. The Flow Trace page is displayed.

  4. Click the TextMessage component instance. The Audit page is displayed.

  5. Click the Flow-Debug tab to debug the instance.

8.4.9 Accessing Queues and Topics Created in 11g from the OC4J 10.1.3.4 Server

This section describes the procedure for accessing queues and topics you created in Oracle Application Server 11g from OC4J 10.1.3.4. To do this, you must configure Oracle BPEL PM JMS adapter with Oracle WebLogic Server.

The following are the steps to configure Oracle BPEL PM JMS adapter with Oracle WebLogic Server:

  1. Create the wlfullclient.jar file using the following steps:

    1. Change to the server/lib directory, as shown in the following example:

      cd WL_HOME/server/lib
      
    2. Use the following command to create the wlfullclient.jar file in the server/lib directory:

      java -jar ../../../modules/com.bea.core.jarbuilder_X.X.X.X.jar
      

      where X.X.X.X is the version number of the jarbuilder module in the WL_HOME/server/lib directory. For example:

      java -jar ../../../modules/com.bea.core.jarbuilder_1.0.1.0.jar
      
  2. Copy the wlfullclient.jar file to the 10.1.3.4. server at the following location:

    <ORACLEAS_HOME>/j2ee/<OC4J_INSTANCE>/connectors/JmsAdapter/JmsAdapter
    
  3. Configure the connector factory setting in the oc4j-ra.xml file, as shown in the following example:

    <connector-factory location="eis/wlsjms/Queue" connector-name="Jms Adapter">
            <config-property name="connectionFactoryLocation"                value="weblogic.jms.ConnectionFactory"/>
            <config-property name="factoryProperties"          value="java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory;java.naming.provider.url=t3://w3.us.oracle.com:7001;java.naming.security.principal=weblogic;java.naming.security.credentials=weblogic"/>
           <config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/>
           <config-property name="isTopic" value="false"/>
           <config-property name="isTransacted" value="false"/>
           <config-property name="username" value=""/>
           <config-property name="password" value=""/>
       <connection-pooling use="none">
       </connection-pooling>
         <security-config use="none">
         </security-config>
    </connector-factory>
    

    Note:

    The isTransacted configuration property value must typically be set to FALSE. Currently, XA integration with WebLogic JMS is not supported unless the adapter is deployed on Oracle WebLogic Server.
  4. Modify the server.xml file of the 10.1.3.4 server to include the environment-naming-url-factory-enabled="true" property, as shown in the following example:

    <application-server
    ...
    ...
    environment-naming-url-factory-enabled="true"
    ...
    > 
    
  5. Restart the 10.1.3.4 server to make the changes come into effect.

8.4.10 Configuring the 11G Server to Access Queues Present in 10.1.3.X OC4J

You can configure your 11G server to access queues present in 10.1.3.x OC4J with the following steps.

8.4.10.1 Copy Jar Files into the domains Folder of the Web Logic Server

Copy the following jar files under the domains/<DOMAIN_NAME>/lib folder of the WebLogic Server:

  • $J2EE_HOME/lib/jms.jar

  • $J2EE_HOME/lib/jta.jar

  • $J2EE_HOME/oc4jclient.jar

  • $AS_HOME/opmn/lib/optic.jar

8.4.10.2 Add Connector factory in the weblogic-ra.xml File

The next step is to add the Connector Factory in the weblogic-ra.xml file:

<connection-instance>
   <jndi-name>eis/oc4jjms/Queue</jndi-name>
    <connection-properties>
       <properties>
        <property>
          <name>ConnectionFactoryLocation</name>
          <value>jms/XAQueueConnectionFactory</value>
         </property>
         <property>
          <name>FactoryProperties</name>
          <value>java.naming.factory.initial=com.evermind.server.rmi. RMIInitialContextFactory;java.naming.provider.url= <PROVIDER_URL>;java.naming.security.principal=oc4jadmin; java.naming.security.credentials=welcome1</value> 
        </property>
        <property>
          <name>AcknowledgeMode</name>
          <value>AUTO_ACKNOWLEDGE</value>
       </property>
       <property>
         <name>IsTopic</name>
         <value>false</value>
       </property>
       <property>
         <name>IsTransacted</name>
         <value>false</value>
       </property>
       <property>
         <name>Username</name>
         <value>oc4jadmin</value>
       </property>
       </property>
       <property>
         <name>Password</name>
        <value>welcome1</value>
      </property>
     </properties>
    </connection-properties>
  </connection-instance>

where <PROVIDER_URL>=opmn://localhost:6003 or, ormi://localhost:12401 to use against a specific node or, opmn:ormi://localhost:6003:oc4j_soa to use against the oc4j_soa instance.

8.4.11 Accessing Distributed Destinations (Queues and Topics) on the WebLogic Server JMS

A distributed destination is a set of destinations (queues, set of physical JMS queue members, or topics, set of physical JMS topic members) that are accessible as a single, logical destination to a client.

Note:

For more information on distributed destinations, and a definition of terms used in this context, visit the Using Distributed Destinations pages at http://download.oracle.com/docs/cd/E13222_01/wls/docs103//jms/dds.html

The JMS Adapter can process messages addressed to a distributed destination member after receiving available notification; it can process available, unavailable, and failure notifications related to a distributed destination member.To have the JMS Adapter process such messages, you need to provide additional properties to provide access to distributed destinations ( queues or topics) with the JMS Adapter.

When you provide additional queues or topics, you can separate multiple FactoryProperty values with a semi-colon. See the following example.

<property>
  <name>FactoryProperties</name>
  <value>ClientID=SOACLient2; TopicMessageDistributionAll=true</value>
</property>

8.4.11.1 Providing JMS Adapter Access to Distributed Destinations

You use three FactoryProperty parameter values to provide adapter access to distributed destinations, to specifically enable the Client ID to be shared by multiple connections, to enable the sharing of Durable subscriptions among multiple subscribers, and to specify whether you want one copy of a message per application or per endpoint. The properties include:

  • ClientIDPolicy

    Use the FactoryProperties parameter ClientIDPolicy property with a value of UNRESTRICTED to enable the Client ID to be shared by multiple connections. The default, if no value is specified, is UNRESTRICTED. The non-default value is RESTRICTED. The default is used in almost all uses, so typically you do not need to set it. See the following example:

    </property>
       <name>FactoryProperties</name>
    <value>ClientIDPolicy=UNRESTRICTED</value>
    
     </property>
    
  • SubscriptionSharingPolicy

    Use the FactoryProperties parameter with a value of SHARABLE to enable the sharing of Durable Subscriptions among multiple subscribers.

    A value of SubscriptionSharingPolicy EXCLUSIVE means you cannot share Durable Subscriptions among multiple subscribers. If you do not specify a value, the default is SHARABLE; in most cases, you will not need to change the value.

     <property> 
        <name>FactoryProperties</name> 
        <value>SubscriptionSharingPolicy=SHARABLE</value> 
     </property>
     
    
  • TopicMessageDistributionAll

    See the section on Distirbuted Topics for more information on the TopicMessageDistributionAll FactoryProperties parameter. You can set it as in the following example:

    <property>
        <name>FactoryProperties</name>
        <value>TopicMessageDistributionAll=true</value>
    </property>
    

8.4.11.2 The JMS Adapter with Distributed Queues and Distributed Topics

Specific inbound and outbound queue and error handling behaviors apply to the JMS Adapter with JMS Distributed Queues and Distributed Topics.

For inbound queues, the JMS Adapter creates an inbound poller thread and registers a notification listener with the WebLogic Server JMS on endpoint activation; it unregisters notification listener upon endpoint deactivation.

The JMS Adapter handles errors in the Distributed environment in the same fashion as such errors are handled in a non-Distributed environment: retriable exceptions lead to message retry; non-retriable exceptions lead to message rejection.

There is no change from the behavior of other Adapters to JMS adapter behavior when the Adapter produces a message to a Distributed Queue.

JMS messages for Distributed Queues are produced by creating a MessageProducer for the Distributed Destination and not for a specific member.

Outbound errors are processed based on fault-policies previously defined for the outbound reference.

For inbound adapters with distributed topics, the JMS Adapter registers a notification listener with the WebLogic Server JMS on endpoint activation. The JMS Adapter creates an inbound poller thread for each available notification received from WebLogic Server JMS for a Distributed Topic member.

The inbound poller thread stops working and necessary cleanup is performed if an unavailable notification is received for the member for which the poller thread was created. The durable subscription is maintained in a similar fashion as in a non-Distributed topic scenario.

The Adapter unregisters the notification listener upon endpoint deactivation. Any message arriving at a Distributed Topic is processed based on the various settings used and the type of Distributed Destination in use: either one copy of a message per application, or one copy of a message per adapter endpoint.

The behaviors for each of these types of Distributed Destination are provided below.

8.4.11.3 One Copy of a Message Per Application (Default Behavior)

The default behavior for WebLogic Server Distributed Topics when used with the JMS Adapter is to provide one copy of a message per application.

When using Replicated Distributed Topics, it is a requirement to configure JMS adapter to use the unrestricted clientid and shared subscription policy which are the default settings. In addition, you need to specify the following message selector “(NOT JMS_WL_DDForwarded)” when defining an activation spec.To achieve better performance you should use Partitioned Distributed Topics.

You also need to configure the JMS Adapter to use unrestricted clientid and shared subscription policy. These two are the default settings for Distributed Destinations.

In this scenario, where there is one copy of a message per application, the client id and subscription name are the same for every Distributed Destination and each adapter instance creates subscriptions on every member.

You must specify (NOT JMS_WL_DDForwarded) when defining an activation spec.

Each message needs to be processed exactly once (that is, there is no duplicate processing.) The name is unique and immutable across server restarts.

An example usage, consisting of a snippet of a connection instance from the weblogic-ra.xml file for a local cluster, is shown below:

<property>
    <name>FactoryProperties</name>
    <value>ClientID=SOAClient1;</value>
</property>

8.4.11.4 One Copy Of a Message Per Adapter Endpoint

The second type of scenario you can employ with Distributed Topics is to have one copy of message per adapter endpoint,where you provide Replicated Distributed Topics for each endpoint.

In this case, either the client id or the subscription name is unique for each adapter instance. The unique part of the member name is immutable across server restarts.

To have one copy of a message per adapter endpoint, set the property TopicMessageDistributionAll (the default of which is false) to true in the FactoryProperties property of the connection instance in the weblogic-ra.xml file.

When using Replicated Distributed Topics you need to configure the JMS adapter to use unrestricted clientid and shared subscription policy, which are the default settings.

At the same time, to achieve subscription name uniqueness, the JMS adapter requires that the property TopicMessageDistributionAll (whose default value is false) is set to true.

You can define this property can be defined by setting the FactoryProperties property of the connection instance in the weblogic-ra.xml file.

An example usage (a snippet of connection instance from weblogic-ra.xml for a local cluster) is shown below. In addition, you need to specify the message selector NOT JMS_WL_DDForwarded when defining an activation spec.

<name>FactoryProperties</name>
<value>ClientID=SOAClient2;TopicMessageDistributionAll=true</value>
</property>
8.4.11.4.1 Specifying the Message Selector when Defining an Activation Spec

You also need to specify a message selector when defining an activation spec. The message selector is required when you create one copy of message per adapter Endpoint.

To specify the selector, use the Adapter Wizard when modeling a composite application that reads from Replicated Distributed Topic The metadata for the message selector you specify will be captured in the .jca file.

Below is an example of a message selector defined in an activation spec.This message selector will filter out the copy of the forwarded message when sending a message to a destination subscriber. This message selector is only applicable for when using Replicated Distributed Topics.

<activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
     <property name="DestinationName" value="jms/DemoInTopic"/>
     <property name="UseMessageListener" value="false"/>
     <property name="DurableSubscriber" value="dsub1"/>
     <property name="MessageSelector" value="NOT JMS_WL_DDForwarded"/>
     <property name="PayloadType" value="TextMessage"/>
</activation-spec>

With Distributed Topics, retriable exceptions lead to message retry, while non- retriable exceptions lead to message rejection.

Available/Unavailable/Failure notification does not impact the working of the outbound adapter reference. The message is produced by creating a MessageProducer for the Distributed Destination and not for a specific member.

In the Distributed Topics environment, as elsewhere, an error will be processed based on the fault policies defined for the outbound reference.

8.4.11.4.2 Compatibility and Migration

Remote Distributed Queue support is feasible for releases of WebLogic JMS back to WLS JMS version 9.0, using the new DestinationAvailabilityListener API. A remote Distributed Topic is not supported if it is older than WebLogic 10.3.4, as "shared subscriptions", "unrestricted client ids", the "not forwarded. In this cae, you will need to instead directly reference a Distributed Topic member JNDI name, and somehow deal with the single subscriber per subscription limitation.