pfx-event:sendCustom
Summary: Producer endpoint that sends custom user-defined events to other Integration Manager instances via the messaging infrastructure.
Overview
The sendCustom method creates a producer that publishes custom events. These events are distributed to other IM instances through the messaging infrastructure with a routing key based on the instance name. This is useful for triggering downstream workflows or distributing work across multiple IM instances.
URI Format
pfx-event:sendCustom?eventType=MY_EVENT&connection=pricefx[&options]
Endpoint Parameters
|
Parameter |
Type |
Default |
Required |
Description |
|---|---|---|---|---|
|
|
|
|
Yes |
Event type for the custom event to send. Must be in UPPER_SNAKE_CASE (e.g., |
|
|
|
|
Yes |
Pricefx connection name (must be a bean in the Spring context) |
|
|
|
|
No |
Source of data in the exchange: |
|
|
|
|
No |
Name of the header or property when |
Processing Flow
When the sendCustom producer processes an exchange:
-
The payload is extracted from the exchange based on
inputSource/inputSourceName(defaults to body). -
A user event is created with the configured
eventTypeand the payload. -
The event is published to the messaging infrastructure with a routing key based on the instance name.
Examples
Basic: send a custom event from the exchange body
<route id="sendCustomEvent">
<from uri="direct:triggerEvent"/>
<to uri="pfx-event:sendCustom?eventType=MY_DISTRIBUTION_EVENT&connection=pricefx"/>
</route>
Send from a header value
<route id="sendFromHeader">
<from uri="direct:triggerEvent"/>
<setHeader name="eventPayload">
<constant>{"key": "value"}</constant>
</setHeader>
<to uri="pfx-event:sendCustom?eventType=MY_EVENT&connection=pricefx&inputSource=header&inputSourceName=eventPayload"/>
</route>
Send from an exchange property
<route id="sendFromProperty">
<from uri="direct:triggerEvent"/>
<setProperty name="eventData">
<simple>${body}</simple>
</setProperty>
<to uri="pfx-event:sendCustom?eventType=MY_EVENT&connection=pricefx&inputSource=property&inputSourceName=eventData"/>
</route>
Receiving custom events on another instance
On the receiving IM instance, map the custom event type in application properties using the CUSTOM. prefix:
integration.events.event-to-route-mapping.CUSTOM.MY_DISTRIBUTION_EVENT=direct:handleDistributionEvent
Then create a handler route:
<route id="handleDistributionEvent">
<from uri="direct:handleDistributionEvent"/>
<log message="Received distribution event: ${body}"/>
<!-- process the event -->
</route>