Tuesday, October 26, 2010

Oracle XE user for TIBCO Admin Domain repository

If you elect to use TIBCO EMS as the transport of the administration domain, you need to use database as the domain repository. If you plan to use Oracle XE Universal as the database, you might be looking for the reference on what privilege to grant to the user of the schema for the TIBCO Administrator Domain. The following information might help.

Assuming the user you want to create is called "tibpg", run the following sql commands to create the user and grant the privileges. You should be able to specify and use this user in the DomainUtility to create your domain without problem.





Thursday, October 14, 2010

Summary of FileGateway project

I realised some of the previous articles describing the FileGateway are a bit haphazard, un-organised at best. So here is a summary that I hope to clear the mess I have introduced.

Finally we have completed a conceptual FileGateway based on some of the design patterns described in "SOA Design Patterns" by Thomas Erl.

The patterns involved are:

  • File Gateway
  • Data Model Transformation
  • Data Format Transformation
  • Part of Service Broker (707)
  • Part of Enterprise Service Bus (704)

Figure 1: Conceptual Architecture of FileGateway

Here is a summary of articles to follow:

Project Artifacts:

Wednesday, October 13, 2010

Consuming TIBCO EMS Topic Message from Oracle SOA 11g Application

The previous article describes how FileGateway publishes its data transformation completion event. We will see in this article how another application consumes this event.

In this example, we will create a simple Oracle SOA 11g Application that contains a JMS listener and a file writer.

The use case
JMS Message arrives in FGW.FILEREADY topic.

1. JMS adapter receives message.
2. Mediator component maps the input (JMS body) to the input of a File Adapter.
3. File adapter writes the JMS message body into a local file.
4. End of use case.

The Steps
1. Create an empty Oracle SOA 11g Application. Name it as DataLoader. Create a new project called WaitFile within DataLoader. Ensure the fileInfo.xsd created in the previous article is included in this project.

Figure 1: Empty Oracle SOA Application in JDeveloper, with fileInfo.xsd

2. Configure the JMS Adapter
Double click on the composite.xml to open the composite editor. From the "Component Palette" on the right, drag the "JMS Adapter" into the "Exposed Services" pane of the composite editor.

Configure the following:
  • In Step 2 - Service name: WaitFile
  • In Step 3 - Select Third Party JMS Provider
  • In Step 4 - JMS Connection JNDI Name: eis/tibjmsDirect/Topic
  • In Step 5 - Select Define from operation and schema (specified later)
  • In Step 6 - Operation Type: Consume Message, Operation Name: Consume_Message
  • In Step 7 - Destination Name: FGW.FILEREADY. This is the topic name defined in the TIBCO EMS.
  • In Step 8 - Browse for fileInfo in the xsd file.WaitFile
    • Figure 2: Browse Message Schema
    • In Step 9 - Click Finish

    3. Configure the File Adapter
    From the "Component Palette" on the right, drag the "File Adapter" into the "External Refereces" pane of the composite editor.

    Configure the following:
    • In Step 2 - Service name: WriteFileInfo
    • In Step 3 - Select Define from operation and schema (specified later)
    • In Step 4 - Operation Type: Write File, Operation Name: Write
    • In Step 5 - Directory for Outgoing File (physical path): C:\. File Naming Convention (po_%SEQQ%.txt): fileInfo_%SEQ%.txt
    • In Step 6 - Browse for fileInfo in the xsd file.WaitFile
    • In Step 7 - Click Finish

    4. Configure the Mediator
    From the "Component Palette" on the right, drag the "Mediator" into the "Components" pane of the composite editor.

    Configure the following:
    • Name: Mediator1
    • Template: Define Interface Later
    • Click the OK button

    5. Wiring the service, component and reference in the composite.

    Figure 3: Wired service, component and reference

    6. Configure the Mediator
    Double-click the "Medialtor1" component to bring up the mapper. Create a new mapper file, accept the default file name.

    Figure 4: Create new transformation map

    Drag to map the entire source node (imp1:fileInfo) to target node (imp1:fileInfo)

    Figure 5: Mapped source and target

    7. Configure the JMS Module in Oracle SOA Admin Server console
    Make sure your SOA Admin server is started for your domain. Point your browser to http://localhost:7001/console assuming your server runs locally.

    Under the "Domain Structure" menu, click on the "Deployments" menu. Locate the "JmsAdapter" in the Deployments table. Click on the "JmsAdapter", the setting page of "JmsAdapter" is displayed.

    Figure 6: Domain Structure -> Deployments

    Instead of creating a new JMS connection pool, we will just modify the existing pool, for the sake of simplicity. You can always create your own connection pool dedicated to consuming messages from the FileGateway.

    Click on the Configuration tab, then the Outbound Connection Pools sub-tab. Then click on the "eis/tibjmsDirect/Topic"

    Figure 7: Outbound Connection Pool table

    In the "Properties" tab of "eis/tibjmsDirect/Topic", enter the required parameter values for FactoryProperties, Password and Username, then click "Save"

    Figure 8: Connection pool property configuration

    You need to re-deploy the JmsAdapter for the change to be effective. The changes you have made will be stored in a deployment plan.

    Back to the "Deployments" menu. Check the checkbox to the left of "JmsAdapter" and click the "Update" button at the top of the "Deployments" table. Re-deploy the application, create a new plan if necessary.

    Figure 9: Update JmsAdapter deployment

    Figure 10: Deployment plan

    Figure 11: Deployment plan

    8. Deploy the WaitFile SOA 11g application into the soa_server1. (assuming you have created a soa managed server)

    Figure 12: WaitFile composite deployed

    9. Start TIBCO EMS server (make sure you have carried out the steps described in this article). Run FileGateway in TIBCO Designer test mode. A JMS message should be sent out as soon as the data transformation is completed.

    10. Inspect the execution trail and instance information in the dashboard of WaitFile composite.

    Figure 13: Dashboard

    11. Inspect the File adapter output file in the output directory.
    We configured the file adapter to output in c:\, so you should find a file "fileInfo.txt" under this folder. Open the file and inspect the content, you should get something like this.


    Voila, that is a proof of concept of how to connect to and consume JMS message of a TIBCO JMS topic from an Oracle SOA 11g Application.

    Download the Oracle SOA 11g Application source code (JDeveloper project) here.


    Tuesday, October 12, 2010

    A TIBCO BusinessWorks-based file gateway – Part 3

    Publishing an event to TIBCO EMS topic from BusinessWorks.

    We will look at the mechanism to publish the file processing completion events from the FileGateway. The following use case describes the flow.

    Trigger: FileGateway finished writing the XML file to the outbound folder.

    1. FileGateway publishes event to FGW.FILEREADY topic.
    2. End of use case.

    What we need

    A target topic
    We have configured the TIBCO EMS to address part of this requirement. Refer to this article for details of setting up the topic, user and access control list.

    An xml schema for event message
    This schema is used by both the producer and the consumer of the event message. The TIBCO BusinessWorks JMS Publish activity will publish the message according to this schema and the consumer will reference this schema when parsing the message.

    As usual, create the schema using your favorite xml tool. Here is the completed schema.

    <?xml version="1.0" encoding="UTF-8"?>

    Import the xml schema into the TIBCO Designer project.

    If you haven't been following the series of articles on FileGateway, you can learn about the FileGateway in the following posts.

    You may also simply download and examine the baselined TIBCO Designer project from here.

    A JMS Publish activity in the BusinessWorks process
    Here are the steps to add a publish JMS activity into the process
    1. Create a JMS Connection shared configuration.
    Under the PollEmpsCSV folder, create a JMS Connection. Uncheck the "Use JNDI for Connection Factory" as our consumers will be connecting directly without getting the resource handle from the JNDI. Enter the username and password of the fgwuser.

    Start the TIBCO EMS server and click on the "Test Connection" button to ensure correct configuration.

    2. Add a JMS Topic Publisher activity.
    In the PollDumpCompletion process, add a JMS Topic Publisher and name it as "PublishEvent". In the configuration tab, enter "FGW.FILEREADY" in the Destination Topic field. In the "Message Type" dropdown, select "XML Text".

    Create a transition from WriteXMLFile to PublishEvent, and from PublishEvent to End activities.

    With PublishEvent activity selected, go to the "Input Editor" tab. Click on the "+" icon and select "XML Element Reference" from the "Content" dropdown. Browse to the schema fileInfo.xsd and select the element "fileInfo"

    Go to the "Input" tab, map the fileName, fileSize and fileDateTime elements of the activity input to the corresponding fields of $WriteXMLFile process data.

    Duplicate the "property" element of the fileInfo instance to contain additional informations, such as the username and password of the ftp server where the output file is located, the url of the ftp server and so forth. The value of the "transport" element indicates how the output file is hosted. Possible values are ftp, http, https or even a "RESTful file server"?!. Well, the password is in plain-text, not an ideal implementation, but that is a separate exercise!

    Here we are, done. A FileGateway that broadcasts the file conversion event to interested parties. The output JMS body of the event is as follow.

    <?xml version="1.0" encoding="UTF-8"?>

    Download the update FileGateway here.

    In the next article, we will be looking at testing/consuming the publish feature from Oracle SOA Suite.


    Thursday, October 7, 2010

    Configuring TIBCO EMS for FileGateway to broadcast completion event

    In our next article, we will add a new feature to the FileGateway. This article describes the steps to setup the EMS for that purpose.

    We need:
    • a secured topic
    • an EMS user
    • authorization enabled EMS
    • access control list (acl)

    Before you start

    Start EMS server.
    - simply execute tibemsd.exe in the bin folder of your TIBCO EMS installation (windows). The default EMS_HOME for win32 installation is c:\tibco\ems\5.1 for TIBCO EMS 5.1.x.

    %EMS_HOME%\bin\tibemsd.exe -config fullpath_to_your_tibemsd.conf_file

    Launch EMS admin console.
    In the same directory of tibemsd.exe, execute the tibemsadmin.exe


    Connect to EMS server

    - In the TIBCO EMS Administration console, enter the command "connect". Assuming you have not changed the admin password, login as admin with no password.

    Creating a topic and securing it

    We will create a EMS topic called FGW.FILEREADY to which the FileGateway will publish its file completion events. Just to add a little security to it, we will secure this topic by allowing only authorized consumers to subscribe, effectively blocking the anonymous consumers.

    Enter the following commands into the admin console.

    create topic FGW.FILEREADY secure
    To see the newly created topic in the console, enter the following command.

    show topics
    Note the '+' sign under the column 'S', it indicates the topic is secured.

    Enable EMS authorization

    The 'secure' property of a EMS topic or queue will only come to effect if the server authorization is enabled. To enable authorization on EMS server, enter the following command at the admin console.

    set server authorization=enabled
    Authorization can also be turned on via the tibemsd.conf file.
    authorization = enabled
    Server restart is required if this method is used.

    Creating an EMS user

    To access to secured topics, the JMS consumer needs to provide credentials when subscribing. For that reason we will create a user called "fgwuser" with the password "fgwuser".

    Enter the following commands into the admin console.

    create user fgwuser "FileGateway User" password=fgwuser
    Use the following command to list the created user.

    show user fgwuser

    Configure the access control list (acl)

    The consumer of FGW.FILEREADY topic needs at least the 'subscribe' privilege in order to subscribe to the topic. If the consumer intends to become a durable subscriber, it also needs to be given the 'durable' privilege. Note that in our scenario, the consumer is not allowed to publish to this topic, hence the absence of 'publish' privilege.

    Enter the following command into the admin console.

    grant topic FGW.FILEREADY fgwuser subscribe, durable
    To inspect the privileges assigned to fgwuser, use the following commands

    showacl topic FGW.FILEREADY


    showacl user fgwuser


    By now we have configured/created the following:
    • A secured EMS topic called FGW.FILEREADY
    • An EMS user called fgwuser
    • Access control on fgwuser
    • EMS server authorization = enabled

    We will update the FileGateway to publish file completion events to this topic in our next article.

    Cheers, happy publishing...

    Tuesday, October 5, 2010

    Oracle RCU on Oracle XE Universal

    OK, this post is going to be quick.

    I am setting up my other notebook to run Oracle SOA Suite and start by installing a copy of Oracle XE Universal. All went well, I need a small footprint database on this old notebook.

    To use OracleXE as the DB for SOA Suite, I only need to modify the following parameters.

    alter system set open_cursors=500 scope=spfile;
    alter system set processes=500 scope=spfile;

    (also depends on with component you want to install, can be less)

    I then downloaded Oracle RCU (ofm_rcu_win32_11. from Oracle and tried to install it with all options selected. To my dismay, I kept bumping into the problem saying JVM is not installed.

    2010-10-05 21:34:56.846 ERROR rcu: oracle.sysman.assistants.rcu.backend.task.ActualTask::run: RCU Operation Failed
    oracle.sysman.assistants.common.task.TaskExecutionException: RCU-6083:Failed - Check prerequisites requirement for selected component:OIM
    Please refer to RCU log at Z:\Oracle\ofm_rcu_win32_11.\rcuHome\rcu\log\logdir.2010-10-05_19-24\rcu.log for details.
    Error: JVM is not installed on the Database.

    Google is your friend, isn't that right? So I found the following thread on the Oracle forum.


    No solution as yet. Some people went back to RCU version and installed successfully. I search further and found that OracleXE does not come with the DBMS_JAVA package, which only available in Oracle SE and EE. In theory, one can install DBMS_JAVA package into XE, but that is illegal. So I ended up unselect the offending components, and everything went well, with a few warnings. Here is the list of components that are unlikely to install successfully into OracleXE if you are going with RCU

    1) Identity Management
    2) Portal and BI

    When installing other components, I have also encountered problems with Enterprise Scheduler Service and the following errors are recorded in the oraess.log. I have ignored all these warnings and will fix them when it comes to surface.

    Executing SQL statement: begin
      execute immediate 'grant select on dba_subscr_registrations to DEV_ORAESS';
      when others then
        if sqlcode = -942 then
        end if;
    JDBC SQLException - ErrorCode: 942SQLState:42000 Message: ORA-00942: table or view does not exist
    ORA-06512: at line 7
    JDBC SQLException handled by error handler

    The reason is because OracleXE does not come with the table DBA_SUBSCR_REGISTRATIONS.

    Information about this table is here.


    Other than that, all was good. I can use OracleXE Universal database for RCU with a few exceptions.