Go to primary content
Oracle® Retail Integration Bus Support Tools Guide
Release 16.0
E80335-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

3 FileIO

Until now, the RIB lacked the feature of publishing/subscribing the messages from/to the file system. The FileIO application facilitates RIB with the functionality to publish/subscribe messages from/to files.

FileIO is a Java enterprise application developed using spring framework. The fileio-<version>.ear works in conjunction with rib-fileio.ear in integrated RIB environment to publish and consume the messages. All retry and error handling capability of RIB is automatically lent to this fileio-<version>.ear application.

Surrounding text describes diagram1.jpg.

The FileIO application along with rib-fileio can be used as a publisher as well as a consumer component. FileIO as a publisher scans the Weblogic server DOMAIN_HOME directory for folder names of the format "<Family>_pub". If the directory is found, it adds a scheduler for that folder and starts polling for files inside it, with the filename format <family>_<type>_<businessObjectId>.<orderedSeqNumber >. If the file matching the criteria is found, message is published to the RIB topic through rib-fileio publisher component.

The subscribing component of the rib-fileio application, subscribes to the message on the RIB topics by calling the injector in rib-fileio. The injector unmarshalls the payload and writes the content to a file in the directory WL_DOMAIN_HOME/<family>_sub. The file name will be of the format <family>_<type>_<businessObjectId>.< orderedSeqNumber>.

Installation and Configuration

Take the following steps to install and configure the application:

  1. Build a new rib-fileio.ear using rib-app-builder tool. The FileIO application is a javaee application.


    Note:

    Refer to the Oracle Retail Integration Bus Implementation Guide Release 16.0.0 for more detailed steps on adding a new rib-<app>.

  2. Compile and deploy rib-fileio.ear using standard rib-app-builder deploy tool.

    • Note down the jndi.providerUrl, for example: t3://localhost:7001

    • Note down the jndi.securityPrincipal, for example: <weblogic username>

    • Note down jndi.securityCredentials, for example: <weblogic password>


      Note:

      Refer to the Oracle Retail Integration Bus Installation Guide Release 16.0.0, chapter 4 Run the RIB Application Installer for compilation and deployment steps.

  3. Download RibFileIo16.0.0.0ForAll16.x.xApps_eng_ga.zip to a working folder, example fileio-home.

  4. Extract the zip file. The fileio-home directory is created.

  5. Traverse to the directory fileio-home/conf.

  6. Edit the fileio-deployment-env-info.json file.

  7. Provide the following details:

    • FileIoAppServer block points to Admin console and fileio server details.

    • JRibFileIoAppServer to use to fileio (for example, rib-sim)

  8. Deploy the fileio-<version>.ear using fileio deployer script (fileio-deployer.sh).

    • Traverse to the directory fileio-home/bin and run the following commands:

      sh fileio-deployer.sh -setup-credentials -deploy-fileio-app

      The script asks for:

      fileIoAdminServerUserAlias (Credentials for Admin Console)

      fileIoUiUserAlias (Credentials for Fileio user)

      ribFileIoAdminConnectionUrl (Credentials for Rib-sim Admin ui e.g. ibadmin/ribadmin1)


    Note:

    Take the following steps:
    • Set the JAVA_HOME and PATH variables.

    • The above step is required only if FileIO is to be used for publishing. For consume, this step is not required. See defect# 300.


    Sample permission:

    grant codeBase

    "file:/home/xyz/install/wls1221/user_projects/domains/base_domain/-" {

    permission java.security.AllPermission;

    permission oracle.security.jps.service.credstore.CredentialAccessPermission "credstoressp.credstore", "read,write,update,delete";

    permission oracle.security.jps.service.credstore.CredentialAccessPermission "credstoressp.credstore.*", "read,write,update,delete";

    };

  9. Verify that the application is in running/active state using WLS console.

  10. Bounce the server.


    Note:

    To see the system output logs in the console, set the following two variables in the console before starting WLS using the startWebLogic.sh script.

    export SERVER_NAME=<your server name>

    export WLS_REDIRECT_LOG =

    servers/${SERVER_NAME}/logs/${SERVER_NAME}.sysout

General Usage

The following sections provide guidelines on using the application.

Publishing Using FileIO

Take the following steps to publish the payload using FileIO application:

  1. Configure and install using rib-app-builder tool, the application which uses FileIO for publishing the message.


    Note:

    Refer to the Oracle Retail Integration Bus Implementation Guide Release 16.0.0, Chapter 11, RIB Customization/Extension.

  2. Login to rib-admin-gui of the publishing application and make sure that the publishing adapter is up and running.

  3. On the WebLogic server where fileio.ear is installed, under DOMAIN_HOME, create a directory with the name that has a format <message_family>_pub. For example, mkdir Banner_pub.

  4. Copy the payload file to this folder. Rename the file to the format <message family>_<message type>_<businessObjectId>.<orderSeqNumber>. For example, Banner_BannerCre_1.1.

  5. The rib-fileio application automatically schedules a publisher to pick the payload file and publish the file to respective RIB topic. After successful publication the file is deleted from the folder.

  6. To stop publishing, add a file by name "STOP" to the <message_family_pub> folder. For example, touch Banner_pub/STOP.

  7. Notice that the message is not published to the topic and the payload file still remains in the same folder.

  8. Publishing can be resumed by deleting the "STOP" file. For example, rm Banner_pub/STOP.

Consuming Using FileIO

Take the following steps to publish the payload using FileIO application:

  1. Configure and install using rib-app-builder tool, the application which uses FileIO for publishing the message.


    Note:

    Refer to the Oracle Retail Integration Bus Implementation Guide Release 16.0.0, Chapter 11, RIB Customization/Extension.

  2. Publish the message to RIB topic through a publishing adapter or RDMT.

    OR

    For testing purpose, upload the payload.xml file by accessing the link http://<host>:<port>/fileio-web/InvokeInjector.jsp?family=<message_family>&type=<message_type>&businessObjectId=someid. This guides you to place the payload.xml in the application defined WLS folder.

    The host and port are specific to the WLS instance where the FileIO is hosted.

  3. Access the link in the step 2 again.

  4. Scan the folder WL DOMAIN_HOME/<message_family>_sub for the file with the name format <message_family>_<message_type>_<businessObjectId>.<orderSeqNo>.

    The content of the message consumed is written to this file.

Limitations of FileIO

  • Setting routing information during publication is not supported.

  • The read and write operations, associated with the files, do not participate in RIB's XA transaction.

Operational Conditions

In a production environment, it is recommended that you use the Oracle RAC database for hosting RIBAQ topics and RIB related tables. If the database is started in an archive mode, the redo logs are archived into database archive logs. The count of the archive log is proportional to the number of database transactions.

Specific to RIB, every message that flows through RIB participates in database transaction. All the transactions get written to a redo log, which later gets archived. Example transactions involve, queuing the message on to topic, de- queuing from topic, writing error message to hospital tables.

With fileio, publishing of messages in bulk involves creating required number of message files under WLS_DOMAIN_HOME directory, within defined location and file name format that has been already discussed. Since messages are huge in number with bulk messaging scenario, an alarming increase in the database archive logs is expected.

Use Cases

The use cases considered are as follows:

FileIO As a Publisher

FileIO as a publisher, publishes a InvReq message to etInvReq topic and RMS consumes the message from etInvReq topic. The same is depicted in the flow diagram below.

Surrounding text describes diagram2.jpg.

FileIO As a Subscriber

RPM publishes a RegPrcChg message to etRegPrcChgFromRPM topic through rib-rpm and rib-fileio subscribes to the message.

Surrounding text describes diagram3.jpg.

Preparing and Deploying rib-fileio.ear

Take the following steps to prepare and deploy the rib-fileio.ear:

  1. Login to the Unix machine and traverse to rib-home directory.

  2. Create a rib-fileio directory using the command: mkdir application-assembly-home/rib-fileio

  3. Create the rib-fileio adapter specific file.

    1. Create a new file "rib-fileio-adapters.xml" as below, by running touch application-assembly-home/rib-fileio/rib-fileio-adapters.xml. Edit it to add the adapter details as below snippet.

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

      <rib-adapters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="rib-adapters.xsd" appName="rib-fileio">

      <subscribers>

      <message-driven id="RegPrcChg_sub_1" initialState="running" />

      </subscribers>

      <publishers>

      <request-driven id="InvReq_pub_1" initialState="notConfigurable" />

      </publishers>

      <hospitals>

      <timer-driven id="sub_hosp_0" initialState="running" timeDelay="10" >

      <timer-task>

      <class name="com.retek.rib.j2ee.ErrorHospitalRetryTimerTask"/>

      <property name="reasonCode" value="SUB" />

      </timer-task>

      </timer-driven>

      <timer-driven id="jms_hosp_0" initialState="running" timeDelay="10" >

      <timer-task>

      <class name="com.retek.rib.j2ee.ErrorHospitalRetryTimerTask"/>

      <property name="reasonCode" value="JMS"/>

      </timer-task>

      </timer-driven>

      </hospitals>

      </rib-adapters>

    2. Create rib-fileio-adapters-resources-properties as below, by running touch application-assembly-home/rib-fileio/rib-fileio-adapters-resources.properties. Edit it to add the adapter details as below snippet.

      #

      # If this changes, ManagedAdaptersResourcesPropertiesTest will need to

      # change accordingly.

      #

      sub_all.name=Subscribers

      sub_all.desc=Manages all subscribers at the same time

      RegPrcChg_sub_1.name=RegPrcChg Subscriber, channel 1

      RegPrcChg_sub_1.desc=Subscriber for the RegPrcChg family through channel

      InvReq_pub_1.name=InvReq Publisher, channel 1

      InvReq_pub_1.desc=Publisher for the InvReq family through channel 1

      hosp_all.name=Hospital Retriers

      hosp_all.desc=Manages all hospital retriers at the same time

      sub_hosp_0.name=SUB Hospital Retry

      sub_hosp_0.desc=Inject messages into from the Error Hospital

      jms_hosp_0.name=JMS Hospital Retryjms_hosp_0.desc=Re-publish messages from to JMS after JMS is brought back up.

    3. Create rib-fileio.properties as below, by running touch application-assembly-home/rib-fileio/rib-fileio.properties. Edit it to add the adapter details as below snippet.

      #####################################################

      # rib-fileio application specific properties go here. #

      # #

      # All properties have default values, add the #

      # property here only if the default value does not #

      # suit your environment. #

      #####################################################

  4. Add rib-fileio as an application in application-assembly-home/conf/rib-application-assembly-info.xml.

    <rib-app id="rib-fileio" type="javaee-app">

    <ear>

    <classpath refid="rib-app.global.ear.classpath" />

    <java-ee-module>

    <web-war />

    <ejb-jar>

    <classpath refid="rib-app.global.ejb-jar.classpath" />

    </ejb-jar>

    <jms-jca-connector>

    <classpath refid="rib-app.global.jms-jca-connector.classpath"/>

    </jms-jca-connector>

    </java-ee-module>

    </ear>

    <resource>

    <resource-path refid="rib-app.global.resource-path" />

    <resource-path>

    <fileset dir=".">

    <include name="retail/remote_service_locator_info_ribserver.xml" />

    <include name="rib-fileio.properties" />

    <include name="rib-fileio-adapters.xml" />

    <include name="rib-fileio-adapters-resources.properties" />

    </fileset>

    </resource-path>

    </resource>

    </rib-app>

  5. Update the various sections of the deployment-home/conf/rib-deployment-env-info.xml file with the following steps:

    1. Add "fileio" in app-in-scope-for-integration.

      <app-in-scope-for-integration>

      <app id="tafr" type="tafr-app"/>

      <app id="sim" type="javaee-app"/>

      <app id="rpm" type="javaee-app"/>

      <app id="fileio" type="javaee-app">

      </app-in-scope-for-integration>

    2. Define the WebLogic Server information for the fileio application. Add the following XML section under the <weblogic> tag:

      <wls id="rib-fileio-wls1">

      <wls-instance-name>rib-fileio-wls-instance</wls-instance-name>

      <wls-instance-home>ribuser@ribhost.example.com://u00/Oracle/Middleware/user_projects/domains/RIBDomain/servers/rib-fileio-wls-instance</wls-instance-home>

      <wls-listen-port protocol="http">19103</wls-listen-port>

      <wls-user-alias>rib-fileio-wls-user-alias</wls-user-alias>

      </wls>

    3. Edit rib-deployment-env-info.xml and point rib-sim to fileio by modifying the <jndi> section for rib-sim as follows:

      <jndi>

      <url>t3://ribhost.example.com: 19103/fileio</url>

      <factory>weblogic.jndi.WLInitialContextFactory</factory>

      <user-alias>sim_jndi_user-name-alias</user-alias>

      </jndi>

    4. Add the following XML section under the <rib-applications> (before </rib-applications>) section. In the jndi/url xml tag section, point it to the location where fileio-<version>.ear (not rib-fileio.ear) is deployed. Refer to Oracle Retail Integration Bus Installation Guide for details.

      <rib-app id="rib-fileio" type="javaee-app">

      <deploy-in refid="rib-fileio-wls1"/>

      <rib-admin-gui>

      <web-app-url>URL to the rib admin gui app.</web-app-url> <web-app-user-alias>rib-fileio_rib-admin-gui_web-app-user-alias</web-app-user-alias>

      </rib-admin-gui>

      <error-hospital-database> <hosp-url>jdbc:oracle:thin:@ribhost.example.com:1521:ribdev01></hosp-url>

      <hosp-user-alias>rib-fileio_error-hospital-database_user-name-alias</hosp-user-alias>

      </error-hospital-database>

      <app-database-not-applicable/>

      <notifications>

      <email> <email-server-host>mail.example.com</email-server-host>

      <email-server-port>25</email-server-port> <from-address>admin@example.com</from-address> <to-address-list>admin@example.com</to-address-list>

      </email>

      <jmx/>

      </notifications>

      <app id="fileio" type="javaee-app">

      <jndi>

      <url>t3://fileiohost.example.com:7002/fileio</url>

      <factory>weblogic.jndi.WLInitialContextFactory</factory>

      <user-alias>fileio_jndi_user-name-alias</user-alias>

      </jndi>

      </app>

      </rib-app>

  6. Update the rib-integration-flows.xml of rib-func-artifact-<version>.war file to add the publisher and subscriber flow information for the fileio application. Follow these steps:

    • mkdir temp

    • cd temp

    • jar xf ../application-assembly-home/rib-func-artifacts/rib-func-artifact-<version>.war integration/rib-integration-flows.xml

    • edit integration/rib-integration-flows.xml.

      <message-flow id="31">

      <node id="rib-fileio.InvReq_pub" app-name="rib-fileio"

      adapter-class-def="InvReq_pub" type="DbToJms">

      <in-db>default</in-db>

      <out-topic>etInvReq</out-topic>

      </node>

      <node id="rib-sim.InvReq_pub" app-name="rib-sim"

      adapter-class-def="InvReq_pub" type="DbToJms">

      <in-db>default</in-db>

      <out-topic>etInvReq</out-topic>

      </node>

      <node id="rib-rms.InvReq_sub" app-name="rib-rms"

      adapter-class-def="InvReq_sub" type="JmsToDb">

      <in-topic>etInvReq</in-topic>

      <out-db>default</out-db>

      </node>

      </message-flow>

      <message-flow id="34">

      <node id="rib-rpm.RegPrcChg_pub" app-name="rib-rpm"

      adapter-class-def="RegPrcChg_pub" type="DbToJms">

      <in-db>default</in-db>

      <out-topic>etRegPrcChgFromRPM</out-topic>

      </node>

      <node id="rib-sim.RegPrcChg_sub" app-name="rib-sim"

      adapter-class-def="RegPrcChg_sub" type="JmsToDb">

      <in-topic>etRegPrcChgFromRPM</in-topic>

      <out-db>default</out-db>

      </node>

      <node id="rib-fileio.RegPrcChg_sub" app-name="rib-fileio"

      adapter-class-def="RegPrcChg_sub" type="JmsToDb">

      <in-topic>etRegPrcChgFromRPM</in-topic>

      <out-db>default</out-db>

      </node>

    • jar uvf ../application-assembly-home/rib-func-artifacts/rib-func-artifact-<version>.war integration/rib-integration-flows.xml

    • cd ..

    • rm -rf temp

  7. Run rib-app-compiler with -setup-security-credential from application-assembly-home/bin.

  8. Prepare the JMS using rib-app-builder tool.

    For example, rib-home/deployment-home/bin ./rib-app-deployer.sh -prepare-jms

  9. Deploy rib-func-artifact-<version>.war by using rib-app-builder tool.

    For example, rib-home/deployment-home/bin ./rib-app-deployer.sh -deploy-rib-func-artifact-war

  10. Deploy rib-fileio.ear by using rib-app-builder tool.

    For example, rib-home/deployment/bin ./rib-app-deployer.sh -deploy-rib-app-ear rib-fileio

  11. Bounce all rib-<app> servers.

Implementing the Use Cases

Take the following steps to implement "FileIO as publisher" use cases:

  1. Deploy fileio-<version>.ear. Refer to section, Installation and Configuration in this chapter for more details.

  2. Prepare and deploy rib-fileio.ear. Refer to the section, Preparing and Deploying rib-fileio.ear in this chapter for more details.

  3. Login to rib-admin-gui of rib-fileio application and make sure the publishing adapter "InvReq_pub "is up.

  4. Create a directory under WLS_DOMAIN_HOME with name "InvReq _Pub"

  5. Copy InvReqDesc.xml from "retail-public-payload-xml-samples.zip" to above created folder and rename it to "InvReq_InvReqCre_1.1".

  6. The message should be published successfully by rib-fileio. Check rib publishing adapter logs for successful publication.

  7. Check the subscribing adapter logs from rib-rms admin gui for successful subscription.

Take the following steps to implement "FileIO as subscriber" use cases:

  1. Deploy fileio-<version>.ear. Refer to section, Installation and Configuration in this chapter for more details.

  2. Prepare and deploy rib-fileio.ear. Refer to the section, Preparing and Deploying rib-fileio.ear in this chapter for more details.

  3. Login to rib-admin-gui of rib-fileio application and make sure the subscribing adapter "RegPrcChg_sub "is up.

  4. Access URL : http://fileiohost.example.com:7002/fileioweb/InvokeInjector.jsp?family=RegPrcChg&type=RegPrcChgCre&businessObjectId=1001.

  5. Traverse to directory WLS_DOMAIN_HOME and verify that a new directory by name RegPrcChg_sub got created and has a file with name RegPrcChg_RegPrcChgCre_1001_1.1 created in it.