Is it possible use single inbound channel definition to handle multiple incoming events

Hi,

I need to handle a single inbound channel definition to handle multiple different incoming event types. Such that For multiple event definitions I will use the single inbound channel. Is it possible? If yes how can we define the Inbound channel definition “channelEventKeyDetection” in that case?

Thanks
Harish

Yes you can certainly handle different incoming event types on a single inbound channel. The channelEventKeyDetection setting specifies how the message is mapped to a event type and the strategy to use will vary depending on the message. For a simple JSON message, the “jsonField” setting will directly map the value of a json field to a event type. For example, the channel definition file would look like:

   {
         ...
      "channelEventKeyDetection": {
             "jsonField": "type"
         }
   }

and the json message

{
    ....
     "type": "failureEvent"
}

would generate a event of type “failureEvent”. If you need more complex event mapping, you can look at channelEventKeyDetection types of “jsonPointerExpression” (see JsonPointerBasedInboundEventKeyDetector.java for details) or “delegateExpression” to reference a Spring beans that implements the InboundEventKeyDetector class.

1 Like