How to trigger the Releaser from Persistent Scheduler via Kafka

The Payment Releaser has a specific Adapter for consuming Kafka messages from the Persistent Scheduler.

This guide assumes you have a Persistent Scheduler application set up to publish commands ready for execution to Kafka using the maven artefact scheduler-external-trigger-kafka.

For information on how to set up your application for this, please see Standalone Scheduler.

To consume the published messages into your Payment Releaser application you need to do the following:

Step 1: Import Dependency

Add the following dependency to your application’s pom.xml.

<dependency>
    <groupId>com.iconsolutions.ipf.core.releaser</groupId>
    <artifactId>payment-scheduler-adaptor-kafka</artifactId>
</dependency>

Step 2: Configure the Kafka Header filters

The Receive Connector provides a Configuration Spring Bean to filter Kafka messages using the custom headers the Scheduler provides.

The application configuration should be updated to only filter in messages you want your application to use. For guidance on how to do this, please see the Scheduler documentation: core:ipf-persistent-scheduler:features/standalone.adoc#_configure_kafka_header_filters.

Step 3: (Optional) Configure Command Handlers

The Persistent Scheduler Kafka sending module sends through commands. The rules on how we should handle these commands are defined in ExternalSchedulingHelper implementations.

By default, there are two handlers wired in to this payment-scheduler-adaptor-kafka module.

  1. ScheduledInstructionReleaseTrigger

  2. ScheduledTransactionReleaseTrigger

Handler class Supports triggerType of PaymentReleaser method called

ScheduledInstructionReleaseTrigger

"INSTRUCTION_PAYMENT_RELEASE"

prepareInstruction(UnitOfWorkId)

ScheduledTransactionReleaseTrigger

"TRANSACTION_PAYMENT_RELEASE"

releaseTransaction(UnitOfWorkId, SupportingContext)

The "Supports triggerType of" column shows the ExternalTriggerCommand.triggerType values supported. If the triggerType is supported then the respective PaymentReleaser method is called.

The supported triggerType 's are used as defaults as they are provided by a common library defined by the Scheduler Floclient.

Override the Command Handlers

The two default ExternalSchedulingHelper implementations are wired in on the condition there are no other beans of their interfaces present. Therefore, to override their behaviour you can define your own implementations of these interfaces:

  1. ScheduledInstructionReleaseTriggerInterface

  2. ScheduledTransactionReleaseTriggerInterface