Reputation: 171
I am using Hazelcast Queue store in which some computation needs to be done and after that computation I want to put the data in Hazelcast Map. I am using Spring as IOC Container.
The problem is the QueueStore is not aware of HazelCast Instance and to get access to the Map I need hazelCast Instance. I tried doing a setter injection but it gives me a circular dependency error.
<hz:queue name="ProductQueue">
<hz:queue-store enabled="true" store-implementation="productQueueStore"></hz:queue-store>
</hz:queue>
<bean id="productQueueStore"
class="com.csg.ib.fid.crd.etrading.prpl.hazelcast.queuestores.ProductQueueStore"
scope="prototype">
<property name="inst" ref="hazelcastClusterInstance">
</property>
</bean>
Also I tried creating a Factory class and tried to inject the property via factory-bean, factory-method approach but still it gives me a circular dependency error.
Any way I can make my QueueStore aware of the Hazelcast instance? or Any way I can inject HazelCastClusterInstance in my QueueStore? or Any way I can inject IMap refernce in to my QueueStore.(i.e. hazelcastClusterInstance.getMap("Abc")?
Upvotes: 1
Views: 574
Reputation: 11317
This could be very dangerous because there are constraints on what you can do on a queue store thread. If you are using an IMap and randomly hit partitions, probably this will be detected and you get exceptions in your face.
So I think you need to reconsider the current design.
Upvotes: 1