Kishore - I tried the following code:
public HelixTaskResult handleMessage() throws InterruptedException {
Message msg = getMessage();
System.out.println("working with message");
System.out.println(String.format("sub message %s", msg.getMsgSubType()));
ClusterMessagingService service =
_notificationContext.getManager().getMessagingService();
Message respmsg = new
Message(Message.MessageType.TASK_REPLY.name(),
UUID.randomUUID().toString());
respmsg.setCorrelationId(msg.getCorrelationId());
respmsg.setSrcInstanceType(msg.getSrcInstanceType());
respmsg.setMsgState(Message.MessageState.NEW);
String srcInstance = msg.getRecord().getSimpleField("SRC_NAME");
Criteria criteria = new Criteria();
criteria.setInstanceName(srcInstance);
criteria.setRecipientInstanceType(InstanceType.SPECTATOR);
int dest = service.send(criteria, respmsg);
HelixTaskResult result = new HelixTaskResult();
result.setMessage("hello");
result.setSuccess(true);
return result;
}
This did not work.
On Sat, Oct 6, 2018 at 6:49 PM kishore g <[email protected]> wrote:
> You have source instanceID and correlation ID in the message. Send the
> response back using those two and set the msg type as TASK_REPLY. Will try
> to find an example
>
> On Sat, Oct 6, 2018 at 10:06 AM Rob McKinnon <[email protected]>
> wrote:
>
>> Kishore - That was helpful. I am also looking on how to send a response
>> message back to the caller. When the caller sends a message and defines an
>> AsyncCallback, how does the recipient respond so that the AsyncCallback is
>> invoked?
>>
>> On Sat, Oct 6, 2018 at 11:09 AM kishore g <[email protected]> wrote:
>>
>>> Here is an example from Pinot.
>>>
>>> https://github.com/linkedin/pinot/blob/7fe310f3eb20dcac0bb5e8d39a21894fdae2b5ee/pinot-server/src/main/java/com/linkedin/pinot/server/starter/helix/SegmentMessageHandlerFactory.java
>>>
>>>
>>>
>>> // Register message handler factory
>>> SegmentMessageHandlerFactory messageHandlerFactory =
>>> new SegmentMessageHandlerFactory(fetcherAndLoader, _serverInstance.
>>> getInstanceDataManager());
>>> _helixManager.getMessagingService()
>>> .registerMessageHandlerFactory(Message.MessageType.USER_DEFINE_MSG.toString(),
>>> messageHandlerFactory);
>>>
>>>
>>>
>>>
>>>
>>> On Sat, Oct 6, 2018 at 7:51 AM Rob McKinnon <[email protected]>
>>> wrote:
>>>
>>>> Is there a good example available for Cluster Messaging? The tutorial
>>>> demonstrated how to send a message but didn't didn't go into detail about
>>>> how to receive a message. Specifically, I am looking on how to send and
>>>> receive user defined cluster messages.
>>>>
>>>> Thanks,
>>>>
>>>> Rob
>>>>
>>>