ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Magda <dma...@gridgain.com>
Subject Re: Point to point messaging with Ignite
Date Thu, 07 Jan 2016 13:04:25 GMT
In my opinion the best way to implement your scenario is to leverage 
Ignite Compute API.
The reason is that the API guarantees delivery of compute tasks, 
fault-tolerance and uses load balancing to spread tasks among available 
nodes.

The pseudo-code looks like this

// Start the nodes that should receive tasks/messages by marking them 
with 'receiver' flag. IgniteConfiguration cfg =new IgniteConfiguration();

HashMap<String, Object> attrs =new HashMap<>();
attrs.put("receiver",true);

cfg.setUserAttributes(attrs);

ignite = Ignition.start(cfg);


// On sender nodes' side create a cluster group that will contain only 
the nodes with this attr being set. ClusterGroup group = ignite.cluster().forAttribute("receiver",true);

// Task will be executed only on one node from the group. Which one node 
will be taken depends on a load balancer and whether a node is alive or 
not. ignite.compute(group).call(new IgniteCallable<Object>() {
     @Override public Object call()throws Exception {
         // Execution logic. }
});


--
Denis

On 1/7/2016 3:36 PM, kcheng.mvp wrote:
> Thank you very much!
>
>
> I am going to use Ignite Queue  implement this.
>
>
> but you mentioned that* Ignite Queue + [Distributed Countdown Latch + Atomic
> Counter] *
>
>
> why need *Distributed Countdown Latch * or* Atomic Counte* here ? As once an
> entry item from poll from the queue, then other node can not get the same
> entry item.
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Point-to-point-messaging-with-Ignite-tp1191p2426.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Mime
View raw message