private void createOriginalMessage(Exchange exchange, List<Message> messageList) {
   DefaultMessage originalMessage = new DefaultMessage();
   originalMessage.setBody(exchange.getIn().getBody());
   originalMessage.setHeader(
       JMSConstants.HEADER_DEVICE, exchange.getIn().getHeader(JMSConstants.HEADER_DEVICE));
   originalMessage.setHeader(
       JMSConstants.HEADER_GROUNDSTATIONID,
       exchange.getIn().getHeader(JMSConstants.HEADER_GROUNDSTATIONID));
   originalMessage.setHeader(JMSConstants.HEADER_FORWARD, JMSConstants.DIRECT_SEND);
   messageList.add(originalMessage);
 }
Exemple #2
0
 /**
  * Ensure that the headers have been populated from the underlying JMS message before we start
  * mutating the headers
  */
 protected void ensureInitialHeaders() {
   if (jmsMessage != null && !hasPopulatedHeaders()) {
     // we have not populated headers so force this by creating
     // new headers and set it on super
     super.setHeaders(createHeaders());
   }
 }
 public void copyFrom(org.apache.camel.Message that) {
   super.copyFrom(that);
   if (that instanceof MailMessage) {
     MailMessage mailMessage = (MailMessage) that;
     this.originalMailMessage = mailMessage.originalMailMessage;
     this.mailMessage = mailMessage.mailMessage;
   }
 }
  private void createPollingMessage(
      Exchange exchange, List<Message> messageList, TelemetryObject incomingMessage) {
    DefaultMessage pollingMessage = new DefaultMessage();

    if (exchange
        .getIn()
        .getHeader(JMSConstants.HEADER_POLLING)
        .equals(JMSConstants.POLL_GET_COMMAND)) {
      pollingMessage.setBody(new TelemetryCommand(incomingMessage.getName()));
    } else {
      pollingMessage.setBody(
          new TelemetryCommand((String) commandsBidiMap.get(incomingMessage.getName())));
    }
    pollingMessage.setHeader(
        JMSConstants.HEADER_DEVICE, exchange.getIn().getHeader(JMSConstants.HEADER_DEVICE));
    pollingMessage.setHeader(
        JMSConstants.HEADER_GROUNDSTATIONID,
        exchange.getIn().getHeader(JMSConstants.HEADER_GROUNDSTATIONID));
    pollingMessage.setHeader(JMSConstants.HEADER_POLLING, JMSConstants.POLL_GET_COMMAND);
    pollingMessage.setHeader(JMSConstants.HEADER_FORWARD, JMSConstants.DIRECT_CHOOSE_DEVICE);
    messageList.add(pollingMessage);
  }
Exemple #5
0
 @Override
 public void setHeader(String name, Object value) {
   ensureInitialHeaders();
   super.setHeader(name, value);
 }
Exemple #6
0
 @Override
 public void setHeaders(Map<String, Object> headers) {
   ensureInitialHeaders();
   super.setHeaders(headers);
 }