Examples of MessageHandler


Examples of org.apache.hedwig.client.api.MessageHandler

                                  new PubSubException.ClientNotSubscribedException("no subscription to start delivery on"),
                                  request.getTxnId()));
                return;
            }

            MessageHandler handler = new MessageHandler() {
                @Override
                public void deliver(ByteString topic, ByteString subscriberId, Message msg,
                final Callback<Void> callback, final Object context) {

                    PubSubResponse response = PubSubResponse.newBuilder().setProtocolVersion(
View Full Code Here

Examples of org.apache.hedwig.client.api.MessageHandler

            }

            final String topic = HedwigBenchmark.TOPIC_PREFIX + i;

            subscriber.subscribe(ByteString.copyFromUtf8(topic), subId, CreateOrAttach.CREATE_OR_ATTACH);
            subscriber.startDelivery(ByteString.copyFromUtf8(topic), subId, new MessageHandler() {

                @Override
                public void deliver(ByteString thisTopic, ByteString subscriberId, Message msg,
                Callback<Void> callback, Object context) {
                    if (logger.isDebugEnabled())
View Full Code Here

Examples of org.apache.hedwig.client.api.MessageHandler

    public void warmup(int nWarmup) throws Exception {
        ByteString topic = ByteString.copyFromUtf8("warmup" + partitionIndex);
        ByteString subId = ByteString.copyFromUtf8("sub");
        subscriber.subscribe(topic, subId, CreateOrAttach.CREATE_OR_ATTACH);

        subscriber.startDelivery(topic, subId, new MessageHandler() {
            @Override
            public void deliver(ByteString topic, ByteString subscriberId, Message msg, Callback<Void> callback,
            Object context) {
                // noop
                callback.operationFinished(context, null);
View Full Code Here

Examples of org.apache.helix.messaging.handling.MessageHandler

    NotificationContext context = new NotificationContext(null);

    boolean exceptionCaught = false;
    try
    {
      MessageHandler handler = facotry.createHandler(message, context);
    } catch (HelixException e)
    {
      exceptionCaught = true;
    }
    AssertJUnit.assertTrue(exceptionCaught);

    message = new Message(MessageType.CONTROLLER_MSG, "1");
    exceptionCaught = false;
    try
    {
      MessageHandler handler = facotry.createHandler(message, context);
    } catch (HelixException e)
    {
      exceptionCaught = true;
    }
    AssertJUnit.assertFalse(exceptionCaught);
View Full Code Here

Examples of org.apache.helix.messaging.handling.MessageHandler

   
    Message msg = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg.setTgtSessionId(manager.getSessionId());
    try
    {
      MessageHandler aHandler = svc.createHandler(msg, changeContext);
    }
    catch(HelixException e)
    {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg.getMsgId())!= -1);
    }
    Message msg2 = new Message("RandomType", UUID.randomUUID().toString());
    msg2.setTgtSessionId(manager.getSessionId());
    try
    {
      MessageHandler aHandler = svc.createHandler(msg2, changeContext);
    }
    catch(HelixException e)
    {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg2.getMsgId())!= -1);
    }
    Message msg3 = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg3.setTgtSessionId(manager.getSessionId());
    msg3.setCorrelationId("wfwegw");
    try
    {
      MessageHandler aHandler = svc.createHandler(msg3, changeContext);
    }
    catch(HelixException e)
    {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg3.getMsgId())!= -1);
    }
   
    TestAsyncCallback callback = new TestAsyncCallback();
    String corrId = UUID.randomUUID().toString();
    svc.registerAsyncCallback(corrId, new TestAsyncCallback());
    svc.registerAsyncCallback(corrId, callback);
   
    List<Message> msgSent = new ArrayList<Message>();
    msgSent.add(new Message("Test", UUID.randomUUID().toString()));
    callback.setMessagesSent(msgSent);
   
    msg = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg.setTgtSessionId("*");
    msg.setCorrelationId(corrId);
   
    MessageHandler aHandler = svc.createHandler(msg, changeContext);
    Map<String, String> resultMap = new HashMap<String, String>();
    aHandler.handleMessage();
   
    AssertJUnit.assertTrue(callback.isDone());
    AssertJUnit.assertTrue(callback._repliedMessageId.contains(msg.getMsgId()));
  }
View Full Code Here

Examples of org.apache.helix.messaging.handling.MessageHandler

    Message message = new Message(MessageType.NO_OP, "0");
    NotificationContext context = new NotificationContext(null);

    boolean exceptionCaught = false;
    try {
      MessageHandler handler = facotry.createHandler(message, context);
    } catch (HelixException e) {
      exceptionCaught = true;
    }
    AssertJUnit.assertTrue(exceptionCaught);

    message = new Message(MessageType.CONTROLLER_MSG, "1");
    exceptionCaught = false;
    try {
      MessageHandler handler = facotry.createHandler(message, context);
    } catch (HelixException e) {
      exceptionCaught = true;
    }
    AssertJUnit.assertFalse(exceptionCaught);
View Full Code Here

Examples of org.apache.helix.messaging.handling.MessageHandler

    NotificationContext changeContext = new NotificationContext(manager);

    Message msg = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg.setTgtSessionId(manager.getSessionId());
    try {
      MessageHandler aHandler = svc.createHandler(msg, changeContext);
    } catch (HelixException e) {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg.getMsgId()) != -1);
    }
    Message msg2 = new Message("RandomType", UUID.randomUUID().toString());
    msg2.setTgtSessionId(manager.getSessionId());
    try {
      MessageHandler aHandler = svc.createHandler(msg2, changeContext);
    } catch (HelixException e) {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg2.getMsgId()) != -1);
    }
    Message msg3 = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg3.setTgtSessionId(manager.getSessionId());
    msg3.setCorrelationId("wfwegw");
    try {
      MessageHandler aHandler = svc.createHandler(msg3, changeContext);
    } catch (HelixException e) {
      AssertJUnit.assertTrue(e.getMessage().indexOf(msg3.getMsgId()) != -1);
    }

    TestAsyncCallback callback = new TestAsyncCallback();
    String corrId = UUID.randomUUID().toString();
    svc.registerAsyncCallback(corrId, new TestAsyncCallback());
    svc.registerAsyncCallback(corrId, callback);

    List<Message> msgSent = new ArrayList<Message>();
    msgSent.add(new Message("Test", UUID.randomUUID().toString()));
    callback.setMessagesSent(msgSent);

    msg = new Message(svc.getMessageType(), UUID.randomUUID().toString());
    msg.setTgtSessionId("*");
    msg.setCorrelationId(corrId);

    MessageHandler aHandler = svc.createHandler(msg, changeContext);
    Map<String, String> resultMap = new HashMap<String, String>();
    aHandler.handleMessage();

    AssertJUnit.assertTrue(callback.isDone());
    AssertJUnit.assertTrue(callback._repliedMessageId.contains(msg.getMsgId()));
  }
View Full Code Here

Examples of org.apache.helix.messaging.handling.MessageHandler

    record.getSimpleFields().putAll(messageInfo);
    Message taskMessage = new Message(record);
    if (logger.isDebugEnabled()) {
      logger.debug(taskMessage.getRecord().getSimpleFields());
    }
    MessageHandler handler =
        _executor.createMessageHandler(taskMessage, new NotificationContext(null));
    if (handler == null) {
      throw new HelixException("Task message " + taskMessage.getMsgType()
          + " handler not found, task id " + _partitionName);
    }
    // Invoke the internal handler to complete the task
    handler.handleMessage();
    logger.info(_partitionName + " onBecomeCompletedFromOffline completed");
  }
View Full Code Here

Examples of org.apache.muse.core.routing.MessageHandler

            Object[] filler = { getContextPath(), action };
            SoapFault fault = new SoapFault(_MESSAGES.get("ActionNotSupported", filler));
            return fault.toXML();
        }
       
        MessageHandler handler = capability.getMessageHandler(action);
        Method method = handler.getMethod();
       
        Object[] parameters = null;
       
        try
        {
            //
            // translate from XML -> POJO. the reflection call will take
            // care of casting the generic Object references to the actual
            // method parameter types
            //
            parameters = handler.fromXML(soapBody);
           
            //
            // invoke operation and translate result to XML
            //
            Object result = method.invoke(capability, parameters);
           
            return handler.toXML(result);
        }
       
        catch (Throwable error)
        {
            //
View Full Code Here

Examples of org.apache.myfaces.extensions.cdi.message.api.MessageHandler

    {
        this();
        this.messageInterpolator = messageContextConfigTemplate.getMessageInterpolator();
        this.messageResolver = messageContextConfigTemplate.getMessageResolver();

        MessageHandler newMessageHandler = messageContextConfigTemplate.getMessageHandler();

        if (newMessageHandler instanceof CompositeMessageHandler)
        {
            this.messageHandlers.addAll(((CompositeMessageHandler) newMessageHandler).getMessageHandlers());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.