PushNotifications - Kafka

Kafka stores messages in named channels, called topics. OIPA sends the XML message that the PushNotifications attached business rule creates to a Kafka topic. Other applications can read the message from that topic.

OIPA uses Kafka when the matching outbound application record has protocolType set to KAFKA. An outbound application record stores the connection and security settings that OIPA uses to send a message.

The PushNotifications XML, message templates, transaction math variables, and OnPushFailure behavior remain the same for all Push Notifications transports. This topic describes the Kafka settings only.

Processing Flow

  1. OIPA processes an activity and evaluates the attached PushNotifications rule.

  2. If the configured message test is true, OIPA creates the XML message from the template.

  3. OIPA locates the outbound application using the EVENTNAME in PushNotifications and downstream.service.event.mode.

  4. OIPA publishes the XML message to the configured Kafka topic. The Kafka record key is the message GUID when available; otherwise, it is the message ID.

  5. OIPA waits for Kafka to confirm that it stored the message according to the acknowledgement setting. OIPA then records the outbound push as successful and continues activity processing.

The push fails if OIPA cannot reach Kafka, authenticate, gain permission to write to the topic, trust the certificate, or receive the required acknowledgement. OIPA then applies the OnPushFailure configuration. For example, you can set RollbackTransaction and CreateBusinessError to Yes.

Prerequisites

  • Ask the Kafka administrator to create the Kafka cluster and topic, and to provide producer credentials and topic Write and Describe permissions.

  • Get the topic name and one or more bootstrap server addresses from the Kafka administrator. Ensure that OIPA can reach the broker advertised listener address and port.

  • For SASL_SSL, add the Kafka broker certificate or issuing CA certificate to the OIPA truststore. For OAuth bearer authentication, also add the OAuth provider HTTPS certificate or CA certificate when that connection uses the OIPA outbound trust context.

  • Import only public certificates or CA certificates into the OIPA truststore. Do not copy Kafka or OAuth private keys to OIPA.

Kafka Outbound Application Details

Create an outbound application record and an outbound security record through the supported Outbound Applications interface. Set eventName to the exact value of PushNotification/@EVENTNAME. Set environment to the exact value of downstream.service.event.mode.

ActivitySummary: Elements and Attributes
Field Required Description
eventName Yes PushNotifications event name, for example Billing.
environment Yes The OIPA downstream service event mode, for example Development or Production.
protocolType Yes Set to KAFKA.
bootstrapServers Yes Comma-separated initial Kafka broker addresses. Configure multiple brokers in production.
topicName Yes Kafka topic to which OIPA publishes the message.
deliveryMode Yes Mandatory inside outboundConfiguration. Only SYNC is supported. Missing/empty or unknown values are rejected; ASYNC is rejected with an explanation that it is not yet available.
acks Optional; effective all required Omitted defaults to all. all (case-insensitive) and -1 are accepted. 0 and 1 are rejected for synchronous Kafka publishing.
maxTimeOut Optional Synchronous acknowledgment deadline in milliseconds: 1000–15000 when supplied; omitted defaults to 15000. The wait uses the remaining time after setup and send.
clientId No Producer identity shown in Kafka logs and metrics.
securityProtocol Yes Use SASL_PLAINTEXT or SASL_SSL. PLAINTEXT and SSL-only modes are not supported.
saslMechanism Yes One of PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, or OAUTHBEARER.
oauthTokenEndpointUrl OAuth only OAuth token endpoint used for client-credentials authentication.

Configuration validation and existing DEV/QA applications

Kafka validation runs during outbound application create/update and again before publishing.

Only SASL_PLAINTEXT and SASL_SSL security protocols are supported;

Supported sasl mechanisms are PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 and OAUTHBEARER.

PLAIN/SCRAM require BASIC userName/password;

OAUTHBEARER requires OAUTH_CLIENT_CREDENTIALS clientId/clientSecret and oauthTokenEndpointUrl.

Credential values remain case-sensitive. Missing or invalid fields return informative validation errors without exposing secrets.

Security Configuration

For PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512, set outboundSecurity.authType to BASIC. Then provide the Kafka user name and password. For OAUTHBEARER, set outboundSecurity.authType to OAUTH_CLIENT_CREDENTIALS. Then provide the OAuth client ID and client secret.

Use SASL_SSL with OAUTHBEARER in production. Use SASL_SSL with SCRAM-SHA-512 in a secure test environment. Use SASL_PLAINTEXT only on an isolated internal development or test network.

OIPA encrypts the BASIC password or OAuth client secret before it stores the value. If OIPA cannot encrypt a credential when you create or update an outbound application, it fails the operation. OIPA does not store a plaintext fallback. Do not log credentials, decrypted values, OAuth tokens, or key-management material.

Security Protocol SASL Mechanism Supported Use
SASL_SSL OAUTHBEARER Recommended for production and cloud deployments.
SASL_SSL SCRAM-SHA-512 Recommended for secure QA; acceptable when OAuth is unavailable.
SASL_SSL SCRAM-SHA-256 or PLAIN Supported. Prefer SCRAM-SHA-512; use PLAIN only for testing.
SASL_PLAINTEXT SCRAM-SHA-512 or SCRAM-SHA-256 Development or QA only on an isolated internal network.
SASL_PLAINTEXT PLAIN or OAUTHBEARER Supported only for local or isolated testing. Traffic is not encrypted.

XML Example: SASL_SSL with SCRAM-SHA-512

{
"outboundApplications": {
"eventName": "Billing",
"environment": "Development",
"protocolType": "KAFKA",
"outboundConfiguration": {
"bootstrapServers": "broker1.example.com:9099,broker2.example.com:9099",
"topicName": "DownstreamMessagePushTopic",
"acks": "all",
"clientId": "oipa-push-notifications-billing",
"securityProtocol": "SASL_SSL",
"saslMechanism": "SCRAM-SHA-512",
"deliveryMode": "SYNC"
},
"maxTimeOut": "10000",
"outboundSecurity": {
"authType": "BASIC",
"authentication": {
"userName": "oipa-producer",
"password": "<producer-password>"
}
}
}
}

XML Example: SASL_SSL with OAuth Bearer

{
"outboundApplications": {
"eventName": "Billing",
"environment": "Production",
"protocolType": "KAFKA",
"outboundConfiguration": {
"bootstrapServers": "broker1.example.com:9100,broker2.example.com:9100",
"topicName": "DownstreamMessagePushTopic",
"acks": "all",
"clientId": "oipa-push-notifications-oauth",
"securityProtocol": "SASL_SSL",
"saslMechanism": "OAUTHBEARER",
"oauthTokenEndpointUrl": "https://oauth.example.com/realms/oipa/protocol/openid-connect/token",
"deliveryMode": "SYNC"
},
"maxTimeOut": "10000",
"outboundSecurity": {
"authType": "OAUTH_CLIENT_CREDENTIALS",
"authentication": {
"clientId": "oipa-kafka-producer",
"clientSecret": "<client-secret>"
}
}
}
}

OIPA Runtime Configuration

Set the event mode in PAS.properties. It must match the outbound application environment. Add outboundeventpush to jmx.notification.entities to view outbound push events in the Admin Console or JMX.

downstream.service.event.mode=Development

jmx.notification.entities=cycle,login,activity,activityprofiling,outboundeventpush

For SASL_SSL, import the Kafka broker public certificate or CA certificate into the OIPA outbound truststore. A truststore is a file that contains certificates OIPA trusts. Set the truststore path in PAS.properties. Set its password in the outbound.trustStorePassword server environment variable. Restart the OIPA application server after you change the truststore, properties, or environment variable.

outbound.trustStore=<truststore-path>
outbound.serviceProtocol=TLS

outbound.serviceProtocol is optional and defaults to TLS. For container deployments, provide the truststore by the approved secret or volume mechanism and store the truststore password in pas_env.dat using the approved secret value. Do not embed credentials, passwords, private keys, or client secrets in an image, source control, or PAS.properties.

Producer Reuse and Lifecycle

OIPA creates one thread-safe Kafka producer lazily per persistent outbound application GUID in each PAS JVM. Subsequent activities, including Cycle processing in that JVM, reuse it. Separate outbound applications and separate JVMs have separate producers;

A digest of the resolved producer properties detects configuration or credential changes. On the next publish, a changed configuration creates a replacement; the old producer closes after its active sends finish. The digest and credentials are not logged. One cleanup task checks every five minutes and removes producers idle for at least 30 minutes with no active sends. Application shutdown retires cached producers; closure waits for active sends to release them.

Producer initialization and capacity: Producers are initialized lazily on temporary virtual threads, outside the cache lock. A fair semaphore allows at most four actual producer constructors concurrently in an OIPA JVM. This is a construction limit, not a limit of four outbound applications or four cached producers. Additional tasks wait for capacity; existing cached producers remain available.

Two deadlines, not two activity allowances: Shared initialization has an independent 15-second deadline from its request, including capacity waiting. It is not tied to the first activity caller. Each activity still waits for acquisition within its own remaining maxTimeOut, so initialization time consumes that activity budget. A short caller timeout does not cancel initialization needed by another caller; maxTimeOut does not receive an extra 15 seconds.

Configuration-aware waiting: KafkaProducerInitialization holds the pending fingerprint, initialization-result future and task-finished future. Matching configurations share the result. A caller with corrected credentials or different effective properties waits for the old task to exit, then retries with its own configuration within its remaining activity deadline. It does not inherit the old authentication failure. Only one pending initialization is retained per application.

Initialization timeout: A scheduled timer fails the shared result after 15 seconds and requests interruption. Initial OAuth HTTPS connect/read waits are capped by the remaining initialization time; later token refresh uses the normal token-client timeout. If a constructor ignores interruption, its construction permit and pending application entry remain until it actually exits. A late producer is closed instead of cached. If all four constructors stay blocked, new construction remains unavailable; the bound is not bypassed.

Lifecycle and troubleshooting: Producers idle for at least 30 minutes with no active sends are eligible for the five-minute cleanup pass. Retirement/closure is deferred until active sends finish. Spring shutdown releases pending result and task-finished waiters, requests worker interruption and retires cached producers. INFO logs identify creation/retirement/closure, FINE logs identify acquisition, and a sanitized WARNING records initialization timeout and requested interruption. Do not log credentials, tokens, full producer properties or fingerprints.

Creation, retirement and closure are logged at INFO; producer acquisition is logged at FINE. Match outboundApplicationGuid and producerId to check reuse. IDs are unique only within the JVM, not across restarts. Acquisition proves producer selection, not message delivery. Enable the Kafka package logger and ensure the configured handlers allow FINE. Locate logs using the active java.util.logging.config.file and catalina.base, not an assumed server directory.

com.adminserver.os.bll.kafka.level = FINE
# The applicable file/console handlers must permit FINE or ALL.

Synchronous Publishing and Kafka Producer Settings

Only synchronous delivery is implemented in this release. OIPA waits for Kafka broker acknowledgment before continuing the outbound push. ASYNC/outbox delivery is future work. Acknowledgment confirms Kafka acceptance, not downstream consumer business processing or an atomic commit with the OIPA database.

Property OIPA value Meaning
acks all Leader waits for the current in-sync replicas. min.insync.replicas is the minimum ISR size required to accept writes, not a fixed acknowledgment count.
enable.idempotence true Protects against duplicate records from Kafka client retries within a producer session. Does not deduplicate separate activity/business retries or producer replacement.
max.in.flight.requests.per.connection 5 Maximum outstanding requests per producer connection. Shared producers can serve concurrent activities, so this setting matters; it is not a message count per activity.
max.block.ms min/ maxTimeOut = 3/ 3000 Limits send waiting for metadata or buffer memory, not the travel time of the message.
request.timeout.ms min / maxTimeOut = 2 / 5000 Wait budget for one broker request, not the overall publish deadline.
delivery.timeout.ms maxTimeOut Producer-level record delivery budget, including batching, acknowledgment and retryable attempts. Configured from the effective application maxTimeOut; not initialization or the complete activity deadline. OIPA can stop waiting earlier.
retry.backoff.ms 100 Pause before retrying a failed request when retry is permitted.
linger.ms 0 No intentional batching delay; simultaneous records can still be batched.
retries 2147483647 Upper retry count. Retries remain bounded by Kafka delivery expiry; non-retriable failures stop retries.

The monotonic publish clock starts after runtime validation and XML serialization, before record/property construction and producer acquisition. Acquisition waits use the activity's remaining maxTimeOut. The manager checks expiry immediately before producer.send(record), then waits for acknowledgment using future.get(remainingNanos, TimeUnit.NANOSECONDS). An already expired request is not enqueued. With maxTimeOut=10000 ms and 2500 ms spent in setup/acquisition/send(), at most 7500 ms remains for acknowledgment; Kafka retries do not receive a new activity deadline.

Remaining limitation and delivery guarantee: Timed acquisition and the independent initialization timer do not make all Java/Kafka operations forcibly interruptible. A non-expired send() can still block up to the static producer max.block.ms even when less activity time remains. For example, 500 ms remaining with max.block.ms=3000 can permit a 2000 ms send() wait followed by an OIPA timeout. No full-max.block.ms reservation check is implemented. A constructor ignoring interruption can also outlive its shared deadline while retaining its permit. Stopping the acknowledgment wait does not retract a queued record: Kafka delivery can still occur and an OIPA database rollback does not undo Kafka acceptance. Consumers must deduplicate business events and operators must reconcile uncertain outcomes before reprocessing. Automatic business-event retry, durable outbox and dead-letter handling remain outside Phase 1.

The record key remains messageGuid with messageId fallback. A unique message key does not guarantee ordering by policy, and producer idempotence does not provide consumer-side business deduplication. These changes do not add a new Kafka message envelope or configurable policy key.

Delivery, Availability, and Monitoring

For a local test that uses one Kafka server, set the topic replication factor to 1. For production, use at least three Kafka servers and set the topic replication factor to 3. A replication factor tells Kafka how many copies of each message to keep. When you set acks=all, Kafka waits for acknowledgements from its synchronized copies. Set min.insync.replicas so that the loss of one server does not reduce the required level of protection. For a replication factor of 3, a common value is 2.

OIPA updates the PushNotifications activity XML with Status=Success when it publishes the message successfully. If the push fails, OIPA applies the existing OnPushFailure behavior. Add outboundeventpush to jmx.notification.entities to view outbound push information, including the Kafka destination, in the Admin Console or Java Management Extensions (JMX).

Configure PushNotifications XML

Use the standard PushNotifications XML. No Kafka-specific element is added to the attached business rule. In the following example, EVENTNAME="Billing" selects the Kafka outbound application whose eventName is Billing.

<PushNotifications>
<Templates>
<Template ID="Header">
<JSTLMessage>
<Parameters>
<Parameter DATATYPE="FORMATDATE" NAME="ActivityEffectiveDate">ActivityEffectiveDate</Parameter>
<Parameter DATATYPE="Text" NAME="ActivityGUID">Activity:ActivityGUID</Parameter>
</Parameters>
<ActivityGUID>[ActivityGUID]</ActivityGUID>
<ActivityEffectiveDate>[ActivityEffectiveDate]</ActivityEffectiveDate>
<EventDateTime>[EVENTDATETIME]</EventDateTime>
</JSTLMessage>
</Template>
</Templates>
<PushNotification EVENTNAME="Billing">
<Message ID="BillingMsg1">
<Tests><Test>1=1</Test></Tests>
<AsEventMessage xmlns="http://xmlns.alamere.com/PAS/AsEventMessage">
<JSTLTemplate>Header</JSTLTemplate>
<JSTLMessage>
<Parameters>
<Parameter DATATYPE="TEXT" NAME="payerName">payerName</Parameter>
<Parameter DATATYPE="BOOLEAN" NAME="isReBill">isReBill</Parameter>
</Parameters>
<Billing>
<payerName>[payerName]</payerName>
<isReBill>[isReBill]</isReBill>
</Billing>
</JSTLMessage>
</AsEventMessage>
</Message>
</PushNotification>
<OnPushFailure>
<RollbackTransaction>Yes</RollbackTransaction>
<CreateBusinessError>Yes</CreateBusinessError>
</OnPushFailure>
</PushNotifications>

Define all math variables and activity fields referenced by the message in the transaction XML, as described in Push Notifications. Attach the PushNotifications rule to the transaction. Do not add PushNotifications to TransactionBusinessRulePacket; it is processed by the PushNotifications HPE flow after core activity processing and before database commit preparation.

Note: dataIntake.kafka.* properties configure the inbound Data Intake Kafka consumer. They are not used by outbound Kafka publishing described in this topic.

Verify the Configuration

  1. Confirm that the Kafka topic exists and that the configured producer has Write and Describe permissions.

  2. Start an authorized Kafka consumer for the topic and configure it to display the record key. The consumer requires topic Read and Describe permissions and Read permission for its consumer group.

  3. Process an OIPA activity that satisfies the PushNotifications message test.

  4. Confirm that the consumer receives the XML message and that the OIPA activity records the outbound push as successful.

  5. To test failure handling, remove the producer Write permission or make the broker unavailable, then confirm that the configured OnPushFailure action occurs.