You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by udayabaski <ba...@gmail.com> on 2017/01/31 04:35:45 UTC

Apache Ignite - Distibuted Queue and Executors

I am planning to use Apache Ignite Distributed Queue.

I am using Ignite with a spring boot application. So, on bootup, I will be
adding 20 names in a queue. But, since there are 3 servers in a cluster, the
same 20 names gets added 3 times. But, i want to add them only once in the
queue.

/Ignite ignite = Ignition.ignite();

IgniteQueue<String> queue = ignite.queue(
    "queueName", // Queue name.
    0,          // Queue capacity. 0 for unbounded queue.
    null         // Collection configuration.
);
/
Distributed executors, will be able to poll from the queue and run the task.
Here, the executor is expected to poll, run the task and then add the same
name to the queue. Trying to achieve round robin here. Only one executor
should be running the same task at any point of time, though there are
multiple servers in a cluster.

Any suggestion for this.





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-Distibuted-Queue-and-Executors-tp10326.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Apache Ignite - Distibuted Queue and Executors

Posted by Andrey Gura <ag...@apache.org>.
Yes, this way is right.

On Tue, Jan 31, 2017 at 5:03 PM, Baskar Sikkayan <ba...@gmail.com> wrote:
> Hi,
>
> ClusterGroup cg = cluster.forOldest();
>
> Is this the way to find the oldest node?
>
> I would like to check if the localNode is the oldest node in the topology to
> execute my code.
>
> Thanks
>
>
> On Jan 31, 2017, at 5:49 AM, Baskar Sikkayan <ba...@gmail.com> wrote:
>
> Hi,
>
>  I will be running ignite along with my Spring boot web application. It
> won’t be a separate application and hence i can not have a client
> application.
>
> But, yes node is oldest topology will work out.
>
> Let me try.
>
>
>
>
>
>
> On Jan 31, 2017, at 3:03 AM, Andrey Gura <ag...@apache.org> wrote:
>
> HI,
>
> Just don't start all nodes with the same code. For example you can
> start 3 server nodes and then start client node that will create and
> fill queue.
>
> Another way, run your code only if your server node is oldest in topology.
>
> On Tue, Jan 31, 2017 at 7:35 AM, udayabaski <ba...@gmail.com> wrote:
>
> I am planning to use Apache Ignite Distributed Queue.
>
> I am using Ignite with a spring boot application. So, on bootup, I will be
> adding 20 names in a queue. But, since there are 3 servers in a cluster, the
> same 20 names gets added 3 times. But, i want to add them only once in the
> queue.
>
> /Ignite ignite = Ignition.ignite();
>
> IgniteQueue<String> queue = ignite.queue(
>   "queueName", // Queue name.
>   0,          // Queue capacity. 0 for unbounded queue.
>   null         // Collection configuration.
> );
> /
> Distributed executors, will be able to poll from the queue and run the task.
> Here, the executor is expected to poll, run the task and then add the same
> name to the queue. Trying to achieve round robin here. Only one executor
> should be running the same task at any point of time, though there are
> multiple servers in a cluster.
>
> Any suggestion for this.
>
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-Distibuted-Queue-and-Executors-tp10326.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>
>
>

Re: Apache Ignite - Distibuted Queue and Executors

Posted by Baskar Sikkayan <ba...@gmail.com>.
Hi,

ClusterGroup cg = cluster.forOldest();

Is this the way to find the oldest node?

I would like to check if the localNode is the oldest node in the topology to execute my code.

Thanks


> On Jan 31, 2017, at 5:49 AM, Baskar Sikkayan <ba...@gmail.com> wrote:
> 
> Hi,
> 
>  I will be running ignite along with my Spring boot web application. It won’t be a separate application and hence i can not have a client application.
> 
> But, yes node is oldest topology will work out.
> 
> Let me try.
> 
> 
> 
> 
> 
> 
>> On Jan 31, 2017, at 3:03 AM, Andrey Gura <ag...@apache.org> wrote:
>> 
>> HI,
>> 
>> Just don't start all nodes with the same code. For example you can
>> start 3 server nodes and then start client node that will create and
>> fill queue.
>> 
>> Another way, run your code only if your server node is oldest in topology.
>> 
>> On Tue, Jan 31, 2017 at 7:35 AM, udayabaski <ba...@gmail.com> wrote:
>>> I am planning to use Apache Ignite Distributed Queue.
>>> 
>>> I am using Ignite with a spring boot application. So, on bootup, I will be
>>> adding 20 names in a queue. But, since there are 3 servers in a cluster, the
>>> same 20 names gets added 3 times. But, i want to add them only once in the
>>> queue.
>>> 
>>> /Ignite ignite = Ignition.ignite();
>>> 
>>> IgniteQueue<String> queue = ignite.queue(
>>>   "queueName", // Queue name.
>>>   0,          // Queue capacity. 0 for unbounded queue.
>>>   null         // Collection configuration.
>>> );
>>> /
>>> Distributed executors, will be able to poll from the queue and run the task.
>>> Here, the executor is expected to poll, run the task and then add the same
>>> name to the queue. Trying to achieve round robin here. Only one executor
>>> should be running the same task at any point of time, though there are
>>> multiple servers in a cluster.
>>> 
>>> Any suggestion for this.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-Distibuted-Queue-and-Executors-tp10326.html
>>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
> 


Re: Apache Ignite - Distibuted Queue and Executors

Posted by Baskar Sikkayan <ba...@gmail.com>.
Hi,

  I will be running ignite along with my Spring boot web application. It won’t be a separate application and hence i can not have a client application.

But, yes node is oldest topology will work out.

Let me try.


Thanks,
Baskar.S



> On Jan 31, 2017, at 3:03 AM, Andrey Gura <ag...@apache.org> wrote:
> 
> HI,
> 
> Just don't start all nodes with the same code. For example you can
> start 3 server nodes and then start client node that will create and
> fill queue.
> 
> Another way, run your code only if your server node is oldest in topology.
> 
> On Tue, Jan 31, 2017 at 7:35 AM, udayabaski <ba...@gmail.com> wrote:
>> I am planning to use Apache Ignite Distributed Queue.
>> 
>> I am using Ignite with a spring boot application. So, on bootup, I will be
>> adding 20 names in a queue. But, since there are 3 servers in a cluster, the
>> same 20 names gets added 3 times. But, i want to add them only once in the
>> queue.
>> 
>> /Ignite ignite = Ignition.ignite();
>> 
>> IgniteQueue<String> queue = ignite.queue(
>>    "queueName", // Queue name.
>>    0,          // Queue capacity. 0 for unbounded queue.
>>    null         // Collection configuration.
>> );
>> /
>> Distributed executors, will be able to poll from the queue and run the task.
>> Here, the executor is expected to poll, run the task and then add the same
>> name to the queue. Trying to achieve round robin here. Only one executor
>> should be running the same task at any point of time, though there are
>> multiple servers in a cluster.
>> 
>> Any suggestion for this.
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-Distibuted-Queue-and-Executors-tp10326.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Apache Ignite - Distibuted Queue and Executors

Posted by Andrey Gura <ag...@apache.org>.
HI,

Just don't start all nodes with the same code. For example you can
start 3 server nodes and then start client node that will create and
fill queue.

Another way, run your code only if your server node is oldest in topology.

On Tue, Jan 31, 2017 at 7:35 AM, udayabaski <ba...@gmail.com> wrote:
> I am planning to use Apache Ignite Distributed Queue.
>
> I am using Ignite with a spring boot application. So, on bootup, I will be
> adding 20 names in a queue. But, since there are 3 servers in a cluster, the
> same 20 names gets added 3 times. But, i want to add them only once in the
> queue.
>
> /Ignite ignite = Ignition.ignite();
>
> IgniteQueue<String> queue = ignite.queue(
>     "queueName", // Queue name.
>     0,          // Queue capacity. 0 for unbounded queue.
>     null         // Collection configuration.
> );
> /
> Distributed executors, will be able to poll from the queue and run the task.
> Here, the executor is expected to poll, run the task and then add the same
> name to the queue. Trying to achieve round robin here. Only one executor
> should be running the same task at any point of time, though there are
> multiple servers in a cluster.
>
> Any suggestion for this.
>
>
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Apache-Ignite-Distibuted-Queue-and-Executors-tp10326.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.