Skip to content

dschulten/spring-integration-samples-routingslip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Routing Slip Examples

External routing slip

It should be possible to control a spring integration flow by means of a dynamic routing slip which can be given to the flow, e.g as a request parameter:

POST http://localhost:8080/transform?routing-slip=capitalize&routing-slip=lowercase
Content-Type: text/plain

example

Problem

The RoutingSlipHeaderValueMessageProcessor takes a static routing slip and processes each item in the slip controlled by its own routing slip index header. To make the behaviour dynamic, a routing slip entry can be a pojo or route strategy. Such a routing slip pojo or RoutingSlipRouteStrategy must return the name of the next channel to which a message should be routed, and it is asked for routes until its routes are exhausted, at which point it is supposed to return null.

However, it is a singleton and therefore cannot maintain status information upon which it could decide which route is next. How can it access an external, dynamic routing slip and decide which of its routes is the current one?

Solution

A possible solution is to maintain the status in message headers.

See ExternalRoutingSlipRouteStrategy and ExternalRoutingSlipRoutePojo and RoutingSlipApplícation for an example flow.

Grouping with Routing Slip

Groups equal Strings, applies routing slip to group.

The routing of single and grouped items must route to a specific channel, otherwise the group is swallowed and the routing slip is applied to all items instead (stranger things).

About

Sample for external routing slip with spring-integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages