Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreOn behalf of the Spring Integration community I’d like to announce the second Milestone of Spring Integration Extension for Hazelcast and its artifact is spring-integration-hazelcast.1.0.0.M2
, which is available in the Milestone Repository.
The project has been around for some time and there has not been so much activity since the previous Milestone 1 and it only recently gained enough community traction to warrant a release. So, first of all, big thanks to you, the community, for your contributions!
Some highlights of the features included to this Milestone:
If you need to elect a leader (e.g. for highly available message consumer where only one node should receive messages) you just need to create a LeaderInitiator:
@Bean
public HazelcastInstance hazelcastInstance() {
return Hazelcast.newHazelcastInstance();
}
@Bean
public LeaderInitiator initiator() {
return new LeaderInitiator(hazelcastInstance());
}
Then when a node is elected leader it will send OnGrantedEvent to all application listeners. See the Spring Integration Reference Manual for more information on how to use those events to control messaging endpoints.
The HazelcastCacheWritingMessageHandler
now can resolve DistributedObject
at runtime against incoming Message
via cacheExpression
property. Supported types are IMap
, MultiMap
, ITopic
, ISet
or IList
:
@Bean
public IMap<Integer, HazelcastIntegrationTestUser> distMap() {
return testHzInstance().getMap("Distributed_Map1");
}
@Bean
@ServiceActivator(inputChannel = "distMapChannel")
public HazelcastCacheWritingMessageHandler hazelcastMessageHandler() {
HazelcastCacheWritingMessageHandler handler =
new HazelcastCacheWritingMessageHandler();
handler.setDistributedObject(distMap());
handler.setKeyExpression(PARSER.parseExpression("payload.id"));
handler.setExtractPayload(true);
return handler;
}
The HazelcastClusterMonitorMessageProducer
enables to listen to the modifications performed on cluster. This is an event-driven channel adapter and listens to related Membership, Distributed Object, Migration, Lifecycle and Client events:
<int-hazelcast:cm-inbound-channel-adapter
channel="monitorChannel"
hazelcast-instance="instance"
monitor-types="MEMBERSHIP, DISTRIBUTED_OBJECT" />
<bean id="instance" class="com.hazelcast.core.Hazelcast"
factory-method="newHazelcastInstance">
<constructor-arg>
<bean class="com.hazelcast.config.Config" />
</constructor-arg>
</bean>
We would like to hear any feedback from the Community before we go straight forward to the 1.0.0.RELEASE
, so, do not hesitate to contact with us via any available communication channel!
Project Page | Issues | Help | Chat