spring-projects / spring-integration-extensions

The Spring Integration Extensions project provides extension components for Spring Integration
http://www.springintegration.org/
279 stars 265 forks source link

spring-integration-hazelcast requires JVM local Hazelcast instance #172

Closed philnate closed 7 years ago

philnate commented 7 years ago

Hi,

I tried to use the LeaderElection functionality for Hazelcast and stumpled upon the fact that org.springframework.integration.hazelcast.HazelcastLocalInstanceRegistrar is checking com.hazelcast.core.Hazelcast for all HazelcastInstances on that JVM. The thing is that this doesn't include HazelcastClients, but in our Scenario we have dedicated Hazelcast server to which we connect with HazelcastClients.

I lack the deeper knowledge of the spring-integration Project, as I'm just after the LeaderElection, but wouldn't it be sufficient to just have a HazelcastInstance autowired, which is then used to register the Listener on to?

For the moment I worked around the issue by tricking Spring into thinking that this Registrar is already present by adding a Dummy bean, which seems to do no harm for the LeaderElection scenario but likely for the other things.

    @Bean( name = "org.springframework.integration.hazelcast.HazelcastLocalInstanceRegistrar" )
    public String HazelcastLocalInstanceRegistrar()
    {
        return "";
    }
artembilan commented 7 years ago

OK. I think you have a point and we should make that local instances selection in the HazelcastLocalInstanceRegistrar as optional if an explicit instance is injected. Right the HazelcastLocalInstanceRegistrar bean must be registered in that case. So, I even guess that we should make an id for that bean much easier.

Sorry, for such an inconvenience.