Skip to content

P6Route

Platform 6 routing order Consumer creates active routing orders from transaction XML submitted via the transaction.p6route() DSL.

Note

Routing orders provide an inbuilt checkpoint restart mechanism in Platform 6. Routing orders can be replayed in the event of failure. They can also be used to trigger service execution asynchronously, leaving the internal routing engine free to queue and schedule execution.

The P6Route URL must contain the name of the destination service that will be called when the routing order is processed.

All headers present in the Camel Exchange input message will be mapped as parameters to the named service. In addition three headers are automatically added:

  • platform6.request.dataPartition
  • platform6.request.dataType
  • platform6.request.ids

Note

When using the Scripts service, these header values can be used to retrieve the transaction as a string using the transaction DSL call: transaction.getUsingPipelineRequest().

The service’s name and parameters are written to the Routing Order (which can be seen using the Routing Orders UI).

If the property execute.async is set to true the service request/response is scheduled and executed using another Thread.

Note

To allow the transactions user interface to Reprocess transactions using P6Route you must add the endpoint uri of the route definition to send the transaction for re-evaluation. This is done using the Viewable attribute ReprocessRouteUri in the XML configuration.

Example

Template: Dev_BaseRoute.groovy

${addRoutes} :=

from('direct:p6router.1')
      .choice()
        .when(xpath("/TransactionInfo/Endpoint='ROUTEME'"))
            .setHeader("platform6.request.action").constant("execute")
               .setHeader("id").constant("RestTank")
            //.setProperty("execute.async").constant(true)
            .to("p6route://scripts")
      .otherwise()
        .throwException(io.platform6.common.util.P6Exception, "No matching rule found for item!")
      .end()
      .routeId("RouteOne")

${destroyRoutes} :=

p6.camel.destroyRoute("RouteOne")

Trigger from a script via:

p6.transaction.saveAndRouteTI(xml, "direct:p6router.1", docId)

Allow reprocessing via the Message UI:

<View>
   <Name>TransactionInfo</Name>
   <Description>
      <EN>TransactionInfo</EN>
   </Description>
   <SmartTags>
      <BusinessDocumentName>TransactionInfo/BusinessDocName</BusinessDocumentName>
      <CurrentDocumentFormat>TransactionInfo/CurrentDocumentFormat</CurrentDocumentFormat>
   </SmartTags>
   <DataType>TransactionInfo</DataType>
   <DataModel>TransactionInfo</DataModel>
   <ReprocessRouteUri>direct:p6router.1</ReprocessRouteUri>
   <!--...-->
</View>