Send events from custom exits to Event Processor

A custom exit can send an event to Event Processor to start an interaction.

The following is an example of a custom action exit:

public class StartInteractionAction implements ExecuteActionExit

{

@Autowired

@Qualifier(EventProcessor.IMPLEMENTATION_ID)

protected EventProcessor eventProcessor;

@Override

public ExecuteActionResult execute(Object currentEditedObject, List<Object> selectedObjects,

SourceDatabaseExternal sourceDatabaseExternal, Map<String, Object> functionArguments)

throws InterplayException

{

ExecuteActionResult result = new ExecuteActionResult();

result.setMessage("Interaction started");

 

// This will create an event object:

Event event = EventBuilder.create()

.setType("InteractionStart")

.setHeader("collectionId", (BusinessCollection)currentEditedObject).getId())

.build();

// This will pass the event object to the Event Processor:

eventProcessor.dispatch(event);

return result;

}

}

Related Links