public static void setSourceFPSName(Message message, String fpsName) throws JMSException {
    if (fpsName == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.SOURCE, fpsName);
  }
  public static void setDocumentID(Message message, String docID) throws JMSException {
    if (docID == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.DOCUMENT_ID, docID);
  }
  public static void setEventDescription(Message message, String description) throws JMSException {
    if (description == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.EVENT_DESCRIPTION, description);
  }
  public static void setProperty(String name, Object value, Message jmsMessage)
      throws JMSException {

    if (jmsMessage == null || name == null) {
      return;
    }

    if (value instanceof Boolean) {
      jmsMessage.setBooleanProperty(name, ((Boolean) value).booleanValue());
    } else if (value instanceof Byte) {
      jmsMessage.setByteProperty(name, ((Byte) value).byteValue());
    } else if (value instanceof Double) {
      jmsMessage.setDoubleProperty(name, ((Double) value).doubleValue());
    } else if (value instanceof Float) {
      jmsMessage.setFloatProperty(name, ((Float) value).floatValue());
    } else if (value instanceof Integer) {
      jmsMessage.setIntProperty(name, ((Integer) value).intValue());
    } else if (value instanceof Long) {
      jmsMessage.setLongProperty(name, ((Long) value).longValue());
    } else if (value instanceof Short) {
      jmsMessage.setShortProperty(name, ((Short) value).shortValue());
    } else if (value instanceof String) {
      jmsMessage.setStringProperty(name, (String) value);
    } else {
      jmsMessage.setObjectProperty(name, value);
    }
  }
  public static void setPortName(Message message, String portName) throws JMSException {
    if (portName == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.PORT_NAME, portName);
  }
  public static void setStateID(Message message, String id) throws JMSException {
    if (id == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.STATE_ID, id);
  }
 /**
  * Set the specified properties in the message.
  *
  * @param properties
  * @throws JMSException
  */
 protected void setMessageProperties(Message message, Map<String, ?> properties)
     throws JMSException {
   if (properties != null) {
     for (Map.Entry<String, ?> entry : properties.entrySet()) {
       Object value = entry.getValue();
       if (value instanceof String) {
         message.setStringProperty(entry.getKey(), (String) value);
       } else if (value instanceof Integer) {
         message.setIntProperty(entry.getKey(), (Integer) value);
       } else if (value instanceof Boolean) {
         message.setBooleanProperty(entry.getKey(), (Boolean) value);
       } else if (value instanceof Byte) {
         message.setByteProperty(entry.getKey(), (Byte) value);
       } else if (value instanceof Double) {
         message.setDoubleProperty(entry.getKey(), (Double) value);
       } else if (value instanceof Float) {
         message.setFloatProperty(entry.getKey(), (Float) value);
       } else if (value instanceof Long) {
         message.setLongProperty(entry.getKey(), (Long) value);
       } else if (value instanceof Short) {
         message.setShortProperty(entry.getKey(), (Short) value);
       } else {
         message.setObjectProperty(entry.getKey(), value);
       }
     }
   }
 }
  public static void setErrorSource(Message message, String errorSource) throws JMSException {
    if (errorSource == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.ERROR_SOURCE, errorSource);
  }
 @Override
 public void addTo(Message message, Class<?> api, Object pojo) throws JMSException {
   log.trace("applyTo api={}, pojo={}", api, pojo);
   String version = getVersion(api);
   if (version != null) {
     message.setStringProperty("VERSION", version);
   }
 }
  public static void setSourceDestinationName(Message message, String sourceDestinationName)
      throws JMSException {
    if (sourceDestinationName == null) {
      return;
    }

    message.setStringProperty(MessagePropertyNames.SOURCE_DESTINATION_NAME, sourceDestinationName);
  }
  public static void setTextData(Message message, String text) throws JMSException {
    if (text == null) {
      return;
    }

    if (message instanceof TextMessage) {
      ((TextMessage) message).setText(text);
    } else {
      message.setStringProperty(MessagePropertyNames.TEXT_DATA, text);
    }
  }
  public static void setCarryForwardContext(Message message, Object carryForwardContext)
      throws JMSException {
    if (carryForwardContext == null) {
      return;
    }
    String carryForwardContextJson;
    //  carryForwardContextJson = fioranoJsonUtil.serialize((CarryForwardContext)
    // carryForwardContext);
    Genson genson = new Genson();
    carryForwardContextJson = genson.serialize(carryForwardContext);

    // message.setObjectProperty(MessagePropertyNames.CARRY_FORWARD_CONTEXT, carryForwardContext);
    message.setStringProperty(MessagePropertyNames.CARRY_FORWARD_CONTEXT, carryForwardContextJson);
  }
Exemple #13
0
  Message createReportResponseMessage(String msg) throws JMSException {
    Message message = _session.createTextMessage(msg);

    // Shove some more field table type in the message just to see if the other end can handle it.
    message.setBooleanProperty("BOOLEAN", true);
    message.setByteProperty("BYTE", (byte) 5);
    message.setDoubleProperty("DOUBLE", Math.PI);
    message.setFloatProperty("FLOAT", 1.0f);
    message.setIntProperty("INT", 1);
    message.setShortProperty("SHORT", (short) 1);
    message.setLongProperty("LONG", (long) 1827361278);
    message.setStringProperty("STRING", "hello");

    return message;
  }
  public void send(ExampleCommand command, String queueName, String filter)
      throws JMSException, IOException {
    try (Session session = connection.createSession()) {

      Message message;
      if (binaryMode) {
        message = session.createBytesMessage();
        ((BytesMessage) message).writeBytes(command.toBytes());
      } else {
        message = session.createTextMessage(command.toXml());
      }

      if (filter != null && !blank(filter)) {
        String[] parts = filter.split("\\s*=\\s*");
        message.setStringProperty(parts[0], parts[1]);
      }
      try (MessageProducer p = session.createProducer(ActiveMQJMSClient.createQueue(queueName))) {
        p.send(message, DeliveryMode.PERSISTENT, 4, 0);
      }
    }
  }
 public static void setUserDefinedId(Message message, String id) throws JMSException {
   if (id == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.USER_DEFINED_DOC_ID, id);
 }
 public static void setSink(Message message, String sink) throws JMSException {
   message.setStringProperty(MessagePropertyNames.SINK, sink);
 }
 public static void setEventModule(Message message, String eventModule) throws JMSException {
   message.setStringProperty(MessagePropertyNames.EVENT_MODULE, eventModule);
 }
 public static void setEventStatus(Message message, String eventStatus) throws JMSException {
   message.setStringProperty(MessagePropertyNames.EVENT_STATUS, eventStatus);
 }
 public static void setEventCategory(Message message, String eventCategory) throws JMSException {
   message.setStringProperty(MessagePropertyNames.EVENT_CATEGORY, eventCategory);
 }
 public static void setExecutingIncr(Message message, String value) throws JMSException {
   if (value == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.EXECUTING_INCR, value);
 }
 public static void setEventProcessVersion(Message message, String version) throws JMSException {
   if (version == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.EVENT_PROCESS_VERSION, version);
 }
  public static void setEventProcessEnv(Message msg, String label) throws JMSException {
    if (label == null) return;

    msg.setStringProperty(MessagePropertyNames.EVENT_PROCESS_ENVIRONMENT, label);
  }
 public static void setEventProcessName(Message message, String name) throws JMSException {
   if (name == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.EVENT_PROCESS_NAME, name);
 }
 public static void setCompInstName(Message message, String name) throws JMSException {
   if (name == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.COMP_INST_NAME, name);
 }
 public static void setEventScope(Message message, String scope) throws JMSException {
   if (scope == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.EVENT_SCOPE, scope);
 }
 public static void setWorkFlowStatus(Message message, String status) throws JMSException {
   if (status == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.WORKFLOW_STATUS, status);
 }
 public static void setWorkFlowInstId(Message message, String id) throws JMSException {
   if (id == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.WORK_FLOW_INST_ID, id);
 }
 public static void setComment(Message message, String comment) throws JMSException {
   if (comment == null) {
     return;
   }
   message.setStringProperty(MessagePropertyNames.COMMENT, comment);
 }