You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-4001: Doc for cooperation with some HZ objects (#4003)
* GH-4001: Doc for cooperation with some HZ objects
Fixes#4001
The `IQueue`, `ITopic` and `IExecutorService` can be used with Spring Integration
channel as is without any extra component implementations.
* Document the cooperation feature with Hazelcast objects via samples
* * Add a sample about an Inbound Channel Adapter on the `IQueue`
* Fix language in docs
Co-authored-by: Gary Russell <grussell@vmware.com>
---------
Co-authored-by: Gary Russell <grussell@vmware.com>
Copy file name to clipboardExpand all lines: src/reference/asciidoc/hazelcast.adoc
+94Lines changed: 94 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -598,3 +598,97 @@ public LockRegistry lockRegistry() {
598
598
When used with a shared `MessageGroupStore` (e.g. `Aggregator` store management), the `HazelcastLockRegistry` can be used to provide this functionality across multiple application instances, such that only one instance can manipulate the group at a time.
599
599
600
600
NOTE: For all the distributed operations the CP Subsystem must be enabled on `HazelcastInstance`.
601
+
602
+
[[hazelcast-message-channels]]
603
+
=== Message Channels with Hazelcast
604
+
605
+
The Hazelcast `IQueue` and `ITopic` distributed objects are, essentially, messaging primitives and can be use with Spring Integration core components without extra implementations in this Hazelcast module.
606
+
607
+
The <<./channel.adoc#channel-implementations-queuechannel,`QueueChannel`>> can be supplied by any `java.util.Queue`, including the mentioned Hazelcast distributed `IQueue`:
return new QueueChannel(hazelcastInstance.Message<?>>getQueue("springIntegrationQueue"));
615
+
}
616
+
----
617
+
====
618
+
619
+
Placing this config on several nodes in Hazelcast cluster of the application, will make the `QueueChannel` as distributed and only one node will be able to poll a single `Message` from that `IQueue`.
620
+
This works similar to <<./jms.adoc#jms-channel,`PollableJmsChannel`>>, <<./kafka.adoc#kafka-channels,`PollableKafkaChannel`>> or <<./amqp.adoc#amqp-channels,`PollableAmqpChannel`>>.
621
+
622
+
If the producer side is not a Spring Integration application, there is no way to configure a `QueueChannel`, and therefore the plain Hazelcast `IQueue` API is used to produce the data.
623
+
In this case, the `QueueChannel` approach is wrong on the consumer side: an <<./channel-adapter.adoc#channel-adapter-namespace-inbound,Inbound Channel Adapter>> solution must be used instead:
624
+
625
+
====
626
+
[source,java]
627
+
----
628
+
@Bean
629
+
public IQueue<String> myStringHzQueue(HazelcastInstance hazelcastInstance) {
0 commit comments