pfx-event:sendCustom

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

eventType

String


Yes

Event type for the custom event to send. Must be in UPPER_SNAKE_CASE (e.g., MY_DISTRIBUTION_EVENT)

connection

String


Yes

Pricefx connection name (must be a bean in the Spring context)

inputSource

String


No

Source of data in the exchange: header, property, or body (defaults to body)

inputSourceName

String


No

Name of the header or property when inputSource is header or property

Processing Flow

When the sendCustom producer processes an exchange:

  1. The payload is extracted from the exchange based on inputSource/inputSourceName (defaults to body).

  2. A user event is created with the configured eventType and the payload.

  3. 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

XML
<route id="sendCustomEvent">
    <from uri="direct:triggerEvent"/>
    <to uri="pfx-event:sendCustom?eventType=MY_DISTRIBUTION_EVENT&amp;connection=pricefx"/>
</route>

Send from a header value

XML
<route id="sendFromHeader">
    <from uri="direct:triggerEvent"/>
    <setHeader name="eventPayload">
        <constant>{"key": "value"}</constant>
    </setHeader>
    <to uri="pfx-event:sendCustom?eventType=MY_EVENT&amp;connection=pricefx&amp;inputSource=header&amp;inputSourceName=eventPayload"/>
</route>

Send from an exchange property

XML
<route id="sendFromProperty">
    <from uri="direct:triggerEvent"/>
    <setProperty name="eventData">
        <simple>${body}</simple>
    </setProperty>
    <to uri="pfx-event:sendCustom?eventType=MY_EVENT&amp;connection=pricefx&amp;inputSource=property&amp;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:

XML
<route id="handleDistributionEvent">
    <from uri="direct:handleDistributionEvent"/>
    <log message="Received distribution event: ${body}"/>
    <!-- process the event -->
</route>