Examples of GenericMessage


Examples of jade.core.messaging.GenericMessage

   
    public final boolean accept(VerticalCommand cmd) {
      String name = cmd.getName();
      if (name.equals(MessagingSlice.SEND_MESSAGE)) {
        AID sender = (AID) cmd.getParam(0);
        GenericMessage gMsg = (GenericMessage) cmd.getParam(1);
        AID receiver = (AID) cmd.getParam(2);
       
        if (TopicUtility.isTopic(receiver)) {
          // This message is directed to a Topic
          AID topic = receiver;
          if (myLogger.isLoggable(Logger.FINE)) {
            myLogger.log(Logger.FINE, "Handling message about topic "+topic.getLocalName());
          }
          ACLMessage msg = gMsg.getACLMessage();
          Collection interestedAgents = topicTable.getInterestedAgents(topic, msg);
          if (interestedAgents.size() > 0) {
            // Forward the message to all agents interested in that topic.
            // Note that if no agents are currently listening to this topic, the message is simply swallowed
            msg.addUserDefinedParameter(ACLMessage.IGNORE_FAILURE, "true");
            gMsg.setModifiable(false);
            Iterator it = interestedAgents.iterator();
            while (it.hasNext()) {
              AID target = (AID) it.next();
              if (myLogger.isLoggable(Logger.FINE)) {
                myLogger.log(Logger.FINE, "Forwarding message to agent "+target.getName());
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

    }

    @SuppressWarnings("unchecked")
    public static org.springframework.integration.message.Message createSpringIntegrationMessage(Exchange exchange, Map<String, Object> headers) {
        org.apache.camel.Message message = exchange.getIn();
        GenericMessage siMessage = new GenericMessage(message.getBody(), headers);
        return siMessage;
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

        return siMessage;
    }

    @SuppressWarnings("unchecked")
    public static org.springframework.integration.message.Message storeToSpringIntegrationMessage(org.apache.camel.Message message) {
        GenericMessage siMessage = new GenericMessage(message.getBody());
        return siMessage;
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

            }
        }

        // Create a new spring message and copy the attributes and body from the camel message
        MessageHeaders messageHeaders = new MessageHeaders(camelMessage.getHeaders());
        return new GenericMessage(camelMessage.getBody(), messageHeaders);
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

            }
        }

        // Create a new spring message and copy the attributes and body from the camel message
        MessageHeaders messageHeaders = new MessageHeaders(camelMessage.getHeaders());
        return new GenericMessage(camelMessage.getBody(), messageHeaders);
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

    }

    @SuppressWarnings("unchecked")
    public static org.springframework.integration.core.Message createSpringIntegrationMessage(Exchange exchange, Map<String, Object> headers) {
        org.apache.camel.Message message = exchange.getIn();
        GenericMessage siMessage = new GenericMessage(message.getBody(), headers);
        return siMessage;
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

        return siMessage;
    }

    @SuppressWarnings("unchecked")
    public static org.springframework.integration.core.Message storeToSpringIntegrationMessage(org.apache.camel.Message message) {
        GenericMessage siMessage = new GenericMessage(message.getBody());
        return siMessage;
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

            }
        }

        // Create a new spring message and copy the attributes and body from the camel message
        MessageHeaders messageHeaders = new MessageHeaders(camelMessage.getHeaders());
        return new GenericMessage(camelMessage.getBody(), messageHeaders);
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

    @Test
    public void testSendingTwoWayMessage() throws Exception {

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelB");
        Message message = new GenericMessage(MESSAGE_BODY);
        //Need to subscribe the responseChannel first
        DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }           
        });
        requestChannel.send(message);
    }
View Full Code Here

Examples of org.springframework.integration.message.GenericMessage

    }

    @SuppressWarnings("unchecked")
    public static org.springframework.integration.core.Message createSpringIntegrationMessage(Exchange exchange, Map<String, Object> headers) {
        org.apache.camel.Message message = exchange.getIn();
        return new GenericMessage(message.getBody(), headers);
    }
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.