Saturday, October 19, 2013

How to read Large Files in parts/chunks in SOA 11g


There is a feature in Oracle File or FTP adapter to read a large file in chunks/parts. The property name to set in file or ftp adapter .jca file is:

<property name="ChunkSize" value="10"/>

The value is the number of chunks or parts, you can specify the number you want. There is no specific option to select while creating File or FTP adpater, simply add the property to the .jca file after the adpater is created.

The .jca file look like below:

<interaction-spec className="oracle.tip.adapter.file.outbound.ChunkedInteractionSpec">
  <property name="DeleteFile" value="true"/>
  <property name="PhysicalDirectory" value="/temp"/>
  <property name="FileName" value="dummy.txt"/>
  <property name="ChunkSize" value="10"/>
</interaction-spec>

After modifying the .jca file, you have to handle the file read through invoke activity in BPEL, that is adding the invoke activy in while loop with condition to check for end of file. The below is the invoke property for end of file:

<bpelx:fromProperty name="jca.file.IsEOF" variable="<Variable>"/>(returnIs End Of the File)

Below are some of proeprties of file inovke for your information,

<bpelx:fromProperties>>
  <bpelx:fromProperty name="jca.file.LineNumber" variable="<Variable>"/> (Returns Line Number)
  <bpelx:fromProperty name="jca.file.ColumnNumber" variable="<Variable>"/>(returnColumnNumber)
  <bpelx:fromProperty name="jca.file.IsEOF" variable="<Variable>"/>(returnIs End Of the File)
  <bpelx:fromProperty name="jca.file.IsMessageRejected" variable="<Variable>"/>(returnIs Message Rejected)
  <bpelx:fromProperty name="jca.file.RejectionReason" variable="<Variable>"/>(returnRejectionReason)
  <bpelx:fromProperty name="jca.file.NoDataFound" variable="<variable>"/>(returnNoDataFound)
</bpelx:fromProperties>

How to Create a Simple JMS Queue in Weblogic Server 11g

This article describes about creating simple JMS Queue in Weblogic server 11g.

1. Introduction and Definitions:

A JMS queue in Weblogic Server is associated with a number of additional resources:


JMS Server

A JMS server acts as a management container for resources within JMS modules. Some of its responsibilities include the maintenance of persistence and state of messages and subscribers. A JMS server is required in order to create a JMS module.


JMS Module

A JMS module is a definition which contains JMS resources such as queues and topics. A JMS module is required in order to create a JMS queue.


Subdeployment

JMS modules are targeted to one or more WLS instances or a cluster. Resources within a JMS module, such as queues and topics are also targeted to a JMS server or WLS server instances. A subdeployment is a grouping of targets. It is also known as advanced targeting.

Connection Factory

A connection factory is a resource that enables JMS clients to create connections to JMS destinations.

JMS Queue

A JMS queue (as opposed to a JMS topic) is a point-to-point destination type. A message is written to a specific queue or received from a specific queue.

The objects used in this example are:


2 Configuration Steps

The following steps are done in the WebLogic Server Console, beginning with the left-hand navigation menu.

2.1 Create a JMS Server

  • Services > Messaging > JMS Servers 
         
  • Select New
  • Name: TestJMSServer
  • Persistent Store: (none)
  • Target: soa_server1 (or choose an available server)
  • Finish

 The JMS server should now be visible in the list with Health OK.


 

2.2 Create a JMS Module

  1. Services > Messaging > JMS Module
  2. Select New
  3. Name: TestJMSModule
  4. Leave the other options empty
  5. Targets: soa_server1 (or choose the same one as the JMS server)
  6. Press Next
  7. Leave “Would you like to add resources to this JMS system module” unchecked and press Finish.

2.3 Create a SubDeployment

A subdeployment is not necessary for the JMS queue to work, but it allows you to easily target subcomponents of the JMS module to a single target or group of targets. We will use the subdeployment in this example to target the following connection factory and JMS queue to the JMS server we created earlier.
  1. Services > Messaging > JMS Modules
  2. Select TestJMSModule
  3. Select the Subdeployments tab and New
  4. Subdeployment Name: TestSubdeployment
  5. Press Next
  6. Here you can select the target(s) for the subdeployment. You can choose either Servers (i.e. WebLogic managed servers, such as the soa_server1) or JMS Servers such as the JMS Server created earlier. As the purpose of our subdeployment in this example is to target a specific JMS server, we will choose the JMS Server option.
    Select the TestJMSServer created earlier
  7. Press Finish
2.4 Create a Connection Factory
  1. Services > Messaging > JMS Modules
  2. Select TestJMSModule and press New
  3. Select Connection Factory and Next
  4. Name: TestConnectionFactory
    JNDI Name: jms/TestConnectionFactory
    Leave the other values at default
  5. On the Targets page, select the Advanced Targeting button and select TestSubdeployment
  6. Press Finish
The connection factory should be listed on the following page with TestSubdeployment and TestJMSServer as the target.

2.5 Create a JMS Queue

  1. Services > Messaging > JMS Modules
  2. Select TestJMSModule and press New
  3. Select Queue and Next
  4. Name: TestJMSQueue
    JNDI Name: jms/TestJMSQueue
    Template: None
    Press Next
  5. Subdeployments: TestSubdeployment
  6. Finish
The TestJMSQueue should be listed on the following page with TestSubdeployment and TestJMSServer.
 
Confirm the resources for the TestJMSModule. Using the Domain Structure tree, navigate to soa_domain > Services > Messaging > JMS Modules then select TestJMSModule
 
You should see the following resources



 
The JMS queue is now complete and can be accessed using the JNDI names
 
jms/TestConnectionFactory and
jms/TestJMSQueue.