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.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.ear application.
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>.
Take the following steps to install and configure the application:
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 14.0 for more detailed steps on adding a new rib-<app>. |
Compile and deploy rib-fileio.ear using standard rib-app-builder deploy tool.
Note down the jndi.providerUrl e.g. t3://localhost:7001
Note down the jndi.securityPrincipal e.g. <weblogic username>
Note down jndi.securityCredentials e.g. <weblogic password>
Note: Refer to the Oracle Retail Integration Bus Installation Guide Release 14.0, chapter 4 Run the RIB Application Installer for compilation and deployment steps. |
Download RibFileIo14.0.0ForAll14.x.xApps_eng_ga.zip to a working folder, example FILEIO_HOME.
Extract the zip file. The FILEIO_HOME /fileio directory is created.
Traverse to the directory FILEIO_HOME/fileio.
Run the command, java -jar config-and-secure.jar
Note: This step is required only if FileIO is to be used for publishing. To use FileIO as a consuming application skip to step 8. |
Provide the following details:
JNDI URL of the rib-<app> to publish the message: The JNDI URL of the WLS server where rib-fileio is hosted.
User Name : The weblogic user name credential to connect to the above provided URL
Password : The password credential to connect to the above provided URL
Deploy the fileio.ear using WebLogic console.
The WebLogic domain must not be an OSB domain as there are spring library conflicts when deployed in OSB domain.
The recommended option is to create a new WebLogic domain called fileio_domain and deploy the application there.
If the tool is used for publishing, edit the weblogic.policy fie located at "${WL_HOME}/wlserver_10.3/server/lib" and give the following permissions to read the wallet file.
Sample permission:
grant codeBase "file:/home/xyz/install/wls1036/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";
};
Verify that the application is in running/active state using WLS console.
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
The following sections provide guidelines on using the application.
Take the following steps to publish the payload using FileIO application:
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 14.0, Chapter 11, RIB Customization/Extension. |
Login to rib-admin-gui of the publishing application and make sure that the publishing adapter is up and running.
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
.
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.
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.
To stop publishing, add a file by name "STOP" to the <message_family_pub> folder. For example, touch Banner_pub/STOP
.
Notice that the message is not published to the topic and the payload file still remains in the same folder.
Publishing can be resumed by deleting the "STOP" file. For example, rm Banner_pub/STOP.
Take the following steps to publish the payload using FileIO application:
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 14.0, Chapter 11, RIB Customization/Extension. |
Publish the message to RIB topic through a publishing adapter or RDMT.
1. 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.
Access the link in the step 2 again.
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.
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.
The use cases considered are as follows:
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.
RPM publishes a RegPrcChg message to etRegPrcChgFromRPM topic through rib-rpm and rib-fileio subscribes to the message.
Take the following steps to prepare and deploy the rib-fileio.ear:
Login to the Unix machine and traverse to rib-home directory.
Create a rib-fileio directory using the command: mkdir application-assembly-home/rib-fileio
Create the rib-fileio adapter specific file.
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>
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.
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. #
#####################################################
Add rib-fileio as an application in application-assembly-hone/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>
Update the various sections of the deployment-home/conf/rib-deployment-env-info.xml file with the following steps:
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>
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>
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>
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.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.oracle.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>
Update the rib-integration-flows.xml of rib-func-artifact.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.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.war integration/rib-integration-flows.xml
cd ..
rm -rf temp
Run rib-app-compiler with -setup-security-credential from application-assembly-home/bin.
Prepare the JMS using rib-app-builder tool.
e.g.: rib-home/deployment-home/bin ./rib-app-deployer.sh -prepare-jms
Deploy rib-func-artifact-war by using rib-app-builder tool.
e.g.: rib-home/deployment-home/bin ./rib-app-deployer.sh -deploy-rib-func-artifact-war
Deploy rib-fileio.ear by using rib-app-builder tool.
e.g.: rib-home/deployment/bin ./rib-app-deployer.sh -deploy-rib-app-ear rib-fileio
Bounce all rib-<app> servers.
Take the following steps to implement "FileIO as publisher" use cases:
Deploy fileio.ear. Refer to section, Installation and Configuration in this chapter for more details.
Prepare and deploy rib-fileio.ear. Refer to the section, Preparing and Deploying rib-fileio.ear in this chapter for more details.
Login to rib-admin-gui of rib-fileio application and make sure the publishing adapter "InvReq_pub "is up.
Create a directory under WLS_DOMAIN_HOME with name "InvReq _Pub"
Copy InvReqDesc.xml from "retail-public-payload-xml-samples.zip" to above created folder and rename it to "InvReq_InvReqCre_1.1".
The message should be published successfully by rib-fileio. Check rib publishing adapter logs for successful publication.
Check the subscribing adapter logs from rib-rms admin gui for successful subscription.
Take the following steps to implement "FileIO as subscriber" use cases:
Deploy fileio.ear. Refer to section, Installation and Configuration in this chapter for more details.
Prepare and deploy rib-fileio.ear. Refer to the section, Preparing and Deploying rib-fileio.ear in this chapter for more details.
Login to rib-admin-gui of rib-fileio application and make sure the subscribing adapter "RegPrcChg_sub "is up.
Access URL : http://fileiohost.example.com:7002/fileioweb/InvokeInjector.jsp?family=RegPrcChg&type=RegPrcChgCre&businessObjectId=1001.
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.