The plugin supports the following modes of operation:
-
polling
: Checks for messages at set intervals instead of waiting for a push notification (default)
-
auto
: Determines the mode automatically from the client request
-
server-sent-events
: Streams messages using server-sent events
-
websocket
: Streams messages over a WebSocket connection
In websocket
mode, the plugin maintains a bi-directional WebSocket connection with the client,
allowing for continuous delivery of Solace messages to the client.
Here’s how it works:
- Establish a WebSocket connection to the Route where the Solace Consume plugin is enabled and mode is set to
websocket
.
- Kong Gateway continuously streams messages as JSON text frames.
- Optionally, client sends acknowledgments (
client-acks
) for each message or batch to enable at-least-once
delivery semantics.
This approach provides real-time message flow without the limitations of HTTP polling.
sequenceDiagram
participant Client
participant Kong as Kong Gateway
participant Broker as Message Broker
Client->>Kong: Establish WebSocket connection
Kong->>Broker: Connect to broker
loop Continuous message delivery
Broker->>Kong: Broker message
Kong->>Client: Stream JSON text frame
opt client-acks
Client->>Kong: Acknowledge message/batch
end
end
Figure 1: The diagram shows the bi-directional WebSocket flow where the Solace Consume plugin is running in websocket
mode, and messages are streamed as JSON text frames.
This mode provides parity with HTTP-based consumption, including support for:
- Message keys
- Topic filtering
- Solace authentication and TLS
- Auto or manual offset commits
When running multiple data plane nodes, there is no thread-safe behavior between nodes. In high-load scenarios, you may observe the same message being delivered multiple times across different data plane nodes.
To minimize duplicate message delivery in a multi-node setup, consider:
- Using a single data plane node for consuming messages from specific topics
- Implementing idempotency handling in your consuming application
- Monitoring Consumer Group offsets across your data plane nodes