Configuring Router Context
Router uses XML configuration to configure routing and mediation rules which are added to a router-context.xml of the OMS. This file is available inside $AF_HOME/roles/omsServer/standalone/services/omsServer/omsServer-4.0.0-SNAPSHOT.jar.
To submit an order, consider an example with engine name as Fulfillment Provisioning.
The following sections take you through the process of configuring the router context:
- Create an instance of submit order router.
- Create a JMS template. To do this, make the following changes:
<bean id="kpsaJmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="kpsaConnectionFactory"/> <property name="destinationResolver" ref="beoDestinationResolver"/> <property name="pubSubDomain" value="false"/> </bean>
- Create a connection factory.
<bean id="kpsaConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"> <constructor-arg> <bean class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="GenericConnectionFactory"/> <property name="jndiTemplate" ref="kpsaJndiTemplate"/> </bean> </constructor-arg> <property name="reconnectOnException" value="true"/> <property name="cacheProducers" value="true"/> </bean>
- Add a JNDI template.
<bean id="kpsaJndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="java.naming.provider.url">tcp://${com.tibco.af.oms.jms.jndi.host}:${com.tibco.af.oms.jms.jndi.port} </prop> <prop key="java.naming.factory.initial">${com.tibco.af.oms.jms.jndi.initialContextFactory} </prop> <prop key="java.naming.security.principal">${com.tibco.af.oms.jms.jndi.security.principal} </prop> <!-- <prop key="java.naming.security.credentials">${jms.jndi.security.credentials}</prop> --> </props> </property> </bean>
- Create a connection factory.
- Assign a destination queue.
<bean id="kpsaSubmitOrderDestination" class="com.tibco.tibjms.TibjmsQueue"> <constructor-arg value="${com.tibco.af.oms.router.destination.kpsaSubmitOrder}" /> </bean>
- Create an instance of Router Message Create.
<bean id="kpsaSubmitMessage" class="com.tibco.aff.oms.router.RouterMessageCreator"/>
- Create an instance of Router.
<bean id="kpsaSubmitOrderRouter" class="com.tibco.aff.oms.router.RouterProcessor"> <property name="jmsTemplate"><ref local="kpsaJmsTemplate"/></property> <property name="destination"><ref local="kpsaSubmitOrderDestination"/></property> <property name="messageCreator"><ref local="kpsaSubmitMessage"/></property> </bean>
- Add an entry to router context for the required action.
<routeContext id="routerContext" xmlns="http://camel.apache.org/schema/spring"> <route id="orderSubmitRoute"> <from uri="direct:tibco.aff.routerproxy.order.submit"/> <choice> <when> <xpath>$orchestrator = 'IPC'</xpath> <to uri="bean:ipcSubmitOrderRouter" pattern="InOnly" /> <transform> <simple> IPC</simple> </transform> <to uri="bean:routerDataProcessor"/> </when> <when> <xpath>$orchestrator = 'KPSA'</xpath> <to uri="bean:kpsaSubmitOrderRouter" pattern="InOnly" /> <transform> <simple>KPSA</simple> </transform> <to uri="bean:routerDataProcessor"/> </when> <otherwise> <to uri="bean:beoSubmitOrderRouter" pattern="InOnly" /> <transform> <simple>AFO</simple> </transform> <to uri="bean:routerDataProcessor"/> </otherwise> </choice> </route>
- Create a JMS template. To do this, make the following changes:
- Changes to ConfigValues using AF Configurator.
Copyright © Cloud Software Group, Inc. All rights reserved.