You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@helix.apache.org by Vinayak Borkar <vi...@gmail.com> on 2013/10/08 03:58:53 UTC
Sending a message to all participants
Hi,
I need to send a message to all live instances in a Helix cluster. I set
the Criteria as follows:
Criteria allParticipantsCriteria = new Criteria();
allParticipantsCriteria.setInstanceName("%");
allParticipantsCriteria.setRecipientInstanceType(InstanceType.PARTICIPANT);
allParticipantsCriteria.setResource("");
allParticipantsCriteria.setPartition("");
However, the number of recipients turns out to be 0. I also tried
changing the datasource in the criteria to be IDEALSTATES using the code
below:
allParticipantsCriteria.setDataSource(DataSource.IDEALSTATES);
But no joy.
Please note that I connect to Helix using an administrator role. When
listing the live instances using the helix-admin client script I do see
one live instance.
Any ideas on what could be going wrong?
Thanks,
Vinayak
Re: Sending a message to all participants
Posted by Vinayak Borkar <vi...@gmail.com>.
Hi Kishore,
I will try that. But since I am setting it to "" it should not matter,
correct? That is the default value for resource and partition in Criteria.
Vinayak
On 10/7/13 7:04 PM, kishore g wrote:
> Hi Vinayak,
>
> Why is resource and partition empty string? if you want to send all live
> instances irrespective what resource/partition they do not set it.
>
> Criteria allParticipantsCriteria = new Criteria();
> allParticipantsCriteria.**setInstanceName("%");
> allParticipantsCriteria.**setRecipientInstanceType(**InstanceTyp
> e.PARTICIPANT);
>
> can you try this
>
> Thanks,
> Kishore G
>
>
> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com> wrote:
>
>> Hi,
>>
>>
>> I need to send a message to all live instances in a Helix cluster. I set
>> the Criteria as follows:
>>
>> Criteria allParticipantsCriteria = new Criteria();
>> allParticipantsCriteria.**setInstanceName("%");
>> allParticipantsCriteria.**setRecipientInstanceType(**
>> InstanceType.PARTICIPANT);
>> allParticipantsCriteria.**setResource("");
>> allParticipantsCriteria.**setPartition("");
>>
>> However, the number of recipients turns out to be 0. I also tried changing
>> the datasource in the criteria to be IDEALSTATES using the code below:
>>
>> allParticipantsCriteria.**setDataSource(DataSource.**IDEALSTATES);
>>
>> But no joy.
>>
>> Please note that I connect to Helix using an administrator role. When
>> listing the live instances using the helix-admin client script I do see one
>> live instance.
>>
>> Any ideas on what could be going wrong?
>>
>> Thanks,
>> Vinayak
>>
>
Re: Sending a message to all participants
Posted by Vinayak Borkar <vi...@gmail.com>.
Tried the self exclusion too. No luck.
But again, the message was being sent by a different application
connected to the cluster using the Administrator option in HelixManager.
So it makes sense that self exclusion does not matter in this case, correct?
Vinayak
On 10/7/13 10:30 PM, Zhen Zhang wrote:
> Hi, could you try allParticipantsCriteria.setSelfExcluded(false), by
> default selfExcluded is true and maybe you are sending from the only
> liveInstance in the cluster, so no liveInstance matches the criteria.
>
> Thanks,
> Jason
>
>
> On Mon, Oct 7, 2013 at 9:30 PM, Vinayak Borkar <vi...@gmail.com> wrote:
>
>> Hi Kishore,
>>
>>
>> As suspected, not setting resource and partition did not help. Any other
>> ideas?
>>
>> Thanks,
>>
>> Vinayak
>>
>>
>> On 10/7/13 7:04 PM, kishore g wrote:
>>
>>> Hi Vinayak,
>>>
>>> Why is resource and partition empty string? if you want to send all live
>>> instances irrespective what resource/partition they do not set it.
>>>
>>> Criteria allParticipantsCriteria = new Criteria();
>>> allParticipantsCriteria.****setInstanceName("%");
>>> allParticipantsCriteria.****setRecipientInstanceType(****InstanceTyp
>>> e.PARTICIPANT);
>>>
>>> can you try this
>>>
>>> Thanks,
>>> Kishore G
>>>
>>>
>>> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com>
>>> wrote:
>>>
>>> Hi,
>>>>
>>>>
>>>> I need to send a message to all live instances in a Helix cluster. I set
>>>> the Criteria as follows:
>>>>
>>>> Criteria allParticipantsCriteria = new Criteria();
>>>> allParticipantsCriteria.****setInstanceName("%");
>>>> allParticipantsCriteria.****setRecipientInstanceType(**
>>>> InstanceType.PARTICIPANT);
>>>> allParticipantsCriteria.****setResource("");
>>>> allParticipantsCriteria.****setPartition("");
>>>>
>>>>
>>>> However, the number of recipients turns out to be 0. I also tried
>>>> changing
>>>> the datasource in the criteria to be IDEALSTATES using the code below:
>>>>
>>>> allParticipantsCriteria.****setDataSource(DataSource.****IDEALSTATES);
>>>>
>>>>
>>>> But no joy.
>>>>
>>>> Please note that I connect to Helix using an administrator role. When
>>>> listing the live instances using the helix-admin client script I do see
>>>> one
>>>> live instance.
>>>>
>>>> Any ideas on what could be going wrong?
>>>>
>>>> Thanks,
>>>> Vinayak
>>>>
>>>>
>>>
>>
>
Re: Sending a message to all participants
Posted by Zhen Zhang <ne...@gmail.com>.
Hi Vinayak, yes. the criteria is queried against either IDEALSTATE or
EXTERNALVIEW. If no resource mapped, the instance will not be selected. A
work around in your case is sending messages to all live instances
directly. This is simple:
HelixDataAccessor accessor = adminManager.getHelixDataAccessor();
PropertyKey.Builder keyBuilder = accessor.keyBuilder();
List<String> liveInstances = accessor.getChildNames(keyBuilder
.liveInstances());
*for* (String liveInstance : liveInstances) {
accessor.setProperty(keyBuilder.message(liveInstance, messageId), message
);
}
Thanks,
Jason
On Mon, Oct 7, 2013 at 11:16 PM, Vinayak Borkar <vi...@gmail.com> wrote:
> Ok. Here is what is going on. It looks like sending a message is connected
> with having resources in the cluster. Once a resource is created, the
> message seems to go to the one live instance in the cluster.
>
> The root cause of this behavior is that Criteria can only pick between
> EXTERNALVIEW and IDEALSTATES as data sources. So instances that do not have
> a resource mapped to it will never satisfy any criteria. Is this by design?
>
> If I wanted to send a message to every live instance, how would I go about
> doing that?
>
>
> Thanks,
> Vinayak
>
>
>
> On 10/7/13 10:30 PM, Zhen Zhang wrote:
>
>> Hi, could you try allParticipantsCriteria.**setSelfExcluded(false), by
>> default selfExcluded is true and maybe you are sending from the only
>> liveInstance in the cluster, so no liveInstance matches the criteria.
>>
>> Thanks,
>> Jason
>>
>>
>> On Mon, Oct 7, 2013 at 9:30 PM, Vinayak Borkar <vi...@gmail.com>
>> wrote:
>>
>> Hi Kishore,
>>>
>>>
>>> As suspected, not setting resource and partition did not help. Any other
>>> ideas?
>>>
>>> Thanks,
>>>
>>> Vinayak
>>>
>>>
>>> On 10/7/13 7:04 PM, kishore g wrote:
>>>
>>> Hi Vinayak,
>>>>
>>>> Why is resource and partition empty string? if you want to send all live
>>>> instances irrespective what resource/partition they do not set it.
>>>>
>>>> Criteria allParticipantsCriteria = new Criteria();
>>>> allParticipantsCriteria.******setInstanceName("%");
>>>> allParticipantsCriteria.******setRecipientInstanceType(******
>>>> InstanceTyp
>>>>
>>>> e.PARTICIPANT);
>>>>
>>>> can you try this
>>>>
>>>> Thanks,
>>>> Kishore G
>>>>
>>>>
>>>> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com>
>>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>>>
>>>>>
>>>>> I need to send a message to all live instances in a Helix cluster. I
>>>>> set
>>>>> the Criteria as follows:
>>>>>
>>>>> Criteria allParticipantsCriteria = new Criteria();
>>>>> allParticipantsCriteria.******setInstanceName("%");
>>>>> allParticipantsCriteria.******setRecipientInstanceType(**
>>>>> InstanceType.PARTICIPANT);
>>>>> allParticipantsCriteria.******setResource("");
>>>>> allParticipantsCriteria.******setPartition("");
>>>>>
>>>>>
>>>>>
>>>>> However, the number of recipients turns out to be 0. I also tried
>>>>> changing
>>>>> the datasource in the criteria to be IDEALSTATES using the code below:
>>>>>
>>>>> allParticipantsCriteria.******setDataSource(DataSource.******
>>>>> IDEALSTATES);
>>>>>
>>>>>
>>>>>
>>>>> But no joy.
>>>>>
>>>>> Please note that I connect to Helix using an administrator role. When
>>>>> listing the live instances using the helix-admin client script I do see
>>>>> one
>>>>> live instance.
>>>>>
>>>>> Any ideas on what could be going wrong?
>>>>>
>>>>> Thanks,
>>>>> Vinayak
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
Re: Sending a message to all participants
Posted by Vinayak Borkar <vi...@gmail.com>.
Ok. Here is what is going on. It looks like sending a message is
connected with having resources in the cluster. Once a resource is
created, the message seems to go to the one live instance in the cluster.
The root cause of this behavior is that Criteria can only pick between
EXTERNALVIEW and IDEALSTATES as data sources. So instances that do not
have a resource mapped to it will never satisfy any criteria. Is this by
design?
If I wanted to send a message to every live instance, how would I go
about doing that?
Thanks,
Vinayak
On 10/7/13 10:30 PM, Zhen Zhang wrote:
> Hi, could you try allParticipantsCriteria.setSelfExcluded(false), by
> default selfExcluded is true and maybe you are sending from the only
> liveInstance in the cluster, so no liveInstance matches the criteria.
>
> Thanks,
> Jason
>
>
> On Mon, Oct 7, 2013 at 9:30 PM, Vinayak Borkar <vi...@gmail.com> wrote:
>
>> Hi Kishore,
>>
>>
>> As suspected, not setting resource and partition did not help. Any other
>> ideas?
>>
>> Thanks,
>>
>> Vinayak
>>
>>
>> On 10/7/13 7:04 PM, kishore g wrote:
>>
>>> Hi Vinayak,
>>>
>>> Why is resource and partition empty string? if you want to send all live
>>> instances irrespective what resource/partition they do not set it.
>>>
>>> Criteria allParticipantsCriteria = new Criteria();
>>> allParticipantsCriteria.****setInstanceName("%");
>>> allParticipantsCriteria.****setRecipientInstanceType(****InstanceTyp
>>> e.PARTICIPANT);
>>>
>>> can you try this
>>>
>>> Thanks,
>>> Kishore G
>>>
>>>
>>> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com>
>>> wrote:
>>>
>>> Hi,
>>>>
>>>>
>>>> I need to send a message to all live instances in a Helix cluster. I set
>>>> the Criteria as follows:
>>>>
>>>> Criteria allParticipantsCriteria = new Criteria();
>>>> allParticipantsCriteria.****setInstanceName("%");
>>>> allParticipantsCriteria.****setRecipientInstanceType(**
>>>> InstanceType.PARTICIPANT);
>>>> allParticipantsCriteria.****setResource("");
>>>> allParticipantsCriteria.****setPartition("");
>>>>
>>>>
>>>> However, the number of recipients turns out to be 0. I also tried
>>>> changing
>>>> the datasource in the criteria to be IDEALSTATES using the code below:
>>>>
>>>> allParticipantsCriteria.****setDataSource(DataSource.****IDEALSTATES);
>>>>
>>>>
>>>> But no joy.
>>>>
>>>> Please note that I connect to Helix using an administrator role. When
>>>> listing the live instances using the helix-admin client script I do see
>>>> one
>>>> live instance.
>>>>
>>>> Any ideas on what could be going wrong?
>>>>
>>>> Thanks,
>>>> Vinayak
>>>>
>>>>
>>>
>>
>
Re: Sending a message to all participants
Posted by Vinayak Borkar <vi...@gmail.com>.
Just to clarify, I have one live instance, but no resources that are
managed by Helix. Is it possible that no participants meet the criteria
because there are no resources (which could be the case if the call is
interpreted to mean all participants that host resources that qualify
the criteria).
If this is the reason why the criteria is not met by participants, is
there a way to have a message delivered to every participant regardless
of the resources hosted by it?
Thanks,
Vinayak
On 10/7/13 10:30 PM, Zhen Zhang wrote:
> Hi, could you try allParticipantsCriteria.setSelfExcluded(false), by
> default selfExcluded is true and maybe you are sending from the only
> liveInstance in the cluster, so no liveInstance matches the criteria.
>
> Thanks,
> Jason
>
>
> On Mon, Oct 7, 2013 at 9:30 PM, Vinayak Borkar <vi...@gmail.com> wrote:
>
>> Hi Kishore,
>>
>>
>> As suspected, not setting resource and partition did not help. Any other
>> ideas?
>>
>> Thanks,
>>
>> Vinayak
>>
>>
>> On 10/7/13 7:04 PM, kishore g wrote:
>>
>>> Hi Vinayak,
>>>
>>> Why is resource and partition empty string? if you want to send all live
>>> instances irrespective what resource/partition they do not set it.
>>>
>>> Criteria allParticipantsCriteria = new Criteria();
>>> allParticipantsCriteria.****setInstanceName("%");
>>> allParticipantsCriteria.****setRecipientInstanceType(****InstanceTyp
>>> e.PARTICIPANT);
>>>
>>> can you try this
>>>
>>> Thanks,
>>> Kishore G
>>>
>>>
>>> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com>
>>> wrote:
>>>
>>> Hi,
>>>>
>>>>
>>>> I need to send a message to all live instances in a Helix cluster. I set
>>>> the Criteria as follows:
>>>>
>>>> Criteria allParticipantsCriteria = new Criteria();
>>>> allParticipantsCriteria.****setInstanceName("%");
>>>> allParticipantsCriteria.****setRecipientInstanceType(**
>>>> InstanceType.PARTICIPANT);
>>>> allParticipantsCriteria.****setResource("");
>>>> allParticipantsCriteria.****setPartition("");
>>>>
>>>>
>>>> However, the number of recipients turns out to be 0. I also tried
>>>> changing
>>>> the datasource in the criteria to be IDEALSTATES using the code below:
>>>>
>>>> allParticipantsCriteria.****setDataSource(DataSource.****IDEALSTATES);
>>>>
>>>>
>>>> But no joy.
>>>>
>>>> Please note that I connect to Helix using an administrator role. When
>>>> listing the live instances using the helix-admin client script I do see
>>>> one
>>>> live instance.
>>>>
>>>> Any ideas on what could be going wrong?
>>>>
>>>> Thanks,
>>>> Vinayak
>>>>
>>>>
>>>
>>
>
Re: Sending a message to all participants
Posted by Zhen Zhang <ne...@gmail.com>.
Hi, could you try allParticipantsCriteria.setSelfExcluded(false), by
default selfExcluded is true and maybe you are sending from the only
liveInstance in the cluster, so no liveInstance matches the criteria.
Thanks,
Jason
On Mon, Oct 7, 2013 at 9:30 PM, Vinayak Borkar <vi...@gmail.com> wrote:
> Hi Kishore,
>
>
> As suspected, not setting resource and partition did not help. Any other
> ideas?
>
> Thanks,
>
> Vinayak
>
>
> On 10/7/13 7:04 PM, kishore g wrote:
>
>> Hi Vinayak,
>>
>> Why is resource and partition empty string? if you want to send all live
>> instances irrespective what resource/partition they do not set it.
>>
>> Criteria allParticipantsCriteria = new Criteria();
>> allParticipantsCriteria.****setInstanceName("%");
>> allParticipantsCriteria.****setRecipientInstanceType(****InstanceTyp
>> e.PARTICIPANT);
>>
>> can you try this
>>
>> Thanks,
>> Kishore G
>>
>>
>> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com>
>> wrote:
>>
>> Hi,
>>>
>>>
>>> I need to send a message to all live instances in a Helix cluster. I set
>>> the Criteria as follows:
>>>
>>> Criteria allParticipantsCriteria = new Criteria();
>>> allParticipantsCriteria.****setInstanceName("%");
>>> allParticipantsCriteria.****setRecipientInstanceType(**
>>> InstanceType.PARTICIPANT);
>>> allParticipantsCriteria.****setResource("");
>>> allParticipantsCriteria.****setPartition("");
>>>
>>>
>>> However, the number of recipients turns out to be 0. I also tried
>>> changing
>>> the datasource in the criteria to be IDEALSTATES using the code below:
>>>
>>> allParticipantsCriteria.****setDataSource(DataSource.****IDEALSTATES);
>>>
>>>
>>> But no joy.
>>>
>>> Please note that I connect to Helix using an administrator role. When
>>> listing the live instances using the helix-admin client script I do see
>>> one
>>> live instance.
>>>
>>> Any ideas on what could be going wrong?
>>>
>>> Thanks,
>>> Vinayak
>>>
>>>
>>
>
Re: Sending a message to all participants
Posted by Vinayak Borkar <vi...@gmail.com>.
Hi Kishore,
As suspected, not setting resource and partition did not help. Any other
ideas?
Thanks,
Vinayak
On 10/7/13 7:04 PM, kishore g wrote:
> Hi Vinayak,
>
> Why is resource and partition empty string? if you want to send all live
> instances irrespective what resource/partition they do not set it.
>
> Criteria allParticipantsCriteria = new Criteria();
> allParticipantsCriteria.**setInstanceName("%");
> allParticipantsCriteria.**setRecipientInstanceType(**InstanceTyp
> e.PARTICIPANT);
>
> can you try this
>
> Thanks,
> Kishore G
>
>
> On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com> wrote:
>
>> Hi,
>>
>>
>> I need to send a message to all live instances in a Helix cluster. I set
>> the Criteria as follows:
>>
>> Criteria allParticipantsCriteria = new Criteria();
>> allParticipantsCriteria.**setInstanceName("%");
>> allParticipantsCriteria.**setRecipientInstanceType(**
>> InstanceType.PARTICIPANT);
>> allParticipantsCriteria.**setResource("");
>> allParticipantsCriteria.**setPartition("");
>>
>> However, the number of recipients turns out to be 0. I also tried changing
>> the datasource in the criteria to be IDEALSTATES using the code below:
>>
>> allParticipantsCriteria.**setDataSource(DataSource.**IDEALSTATES);
>>
>> But no joy.
>>
>> Please note that I connect to Helix using an administrator role. When
>> listing the live instances using the helix-admin client script I do see one
>> live instance.
>>
>> Any ideas on what could be going wrong?
>>
>> Thanks,
>> Vinayak
>>
>
Re: Sending a message to all participants
Posted by kishore g <g....@gmail.com>.
Hi Vinayak,
Why is resource and partition empty string? if you want to send all live
instances irrespective what resource/partition they do not set it.
Criteria allParticipantsCriteria = new Criteria();
allParticipantsCriteria.**setInstanceName("%");
allParticipantsCriteria.**setRecipientInstanceType(**InstanceTyp
e.PARTICIPANT);
can you try this
Thanks,
Kishore G
On Mon, Oct 7, 2013 at 6:58 PM, Vinayak Borkar <vi...@gmail.com> wrote:
> Hi,
>
>
> I need to send a message to all live instances in a Helix cluster. I set
> the Criteria as follows:
>
> Criteria allParticipantsCriteria = new Criteria();
> allParticipantsCriteria.**setInstanceName("%");
> allParticipantsCriteria.**setRecipientInstanceType(**
> InstanceType.PARTICIPANT);
> allParticipantsCriteria.**setResource("");
> allParticipantsCriteria.**setPartition("");
>
> However, the number of recipients turns out to be 0. I also tried changing
> the datasource in the criteria to be IDEALSTATES using the code below:
>
> allParticipantsCriteria.**setDataSource(DataSource.**IDEALSTATES);
>
> But no joy.
>
> Please note that I connect to Helix using an administrator role. When
> listing the live instances using the helix-admin client script I do see one
> live instance.
>
> Any ideas on what could be going wrong?
>
> Thanks,
> Vinayak
>