/**
   * Set
   *
   * @param name The name
   * @param value The value
   * @throws JMSException Thrown if an error occurs
   */
  @Override
  public void setShort(final String name, final short value) throws JMSException {
    if (ActiveMQRAMapMessage.trace) {
      ActiveMQRALogger.LOGGER.trace("setShort(" + name + ", " + value + ")");
    }

    ((MapMessage) message).setShort(name, value);
  }
Exemplo n.º 2
0
 @Override
 public JMSProducer send(Destination destination, Map<String, Object> body) {
   MapMessage message = context.createMapMessage();
   if (body != null) {
     try {
       for (Entry<String, Object> entry : body.entrySet()) {
         final String name = entry.getKey();
         final Object v = entry.getValue();
         if (v instanceof String) {
           message.setString(name, (String) v);
         } else if (v instanceof Long) {
           message.setLong(name, (Long) v);
         } else if (v instanceof Double) {
           message.setDouble(name, (Double) v);
         } else if (v instanceof Integer) {
           message.setInt(name, (Integer) v);
         } else if (v instanceof Character) {
           message.setChar(name, (Character) v);
         } else if (v instanceof Short) {
           message.setShort(name, (Short) v);
         } else if (v instanceof Boolean) {
           message.setBoolean(name, (Boolean) v);
         } else if (v instanceof Float) {
           message.setFloat(name, (Float) v);
         } else if (v instanceof Byte) {
           message.setByte(name, (Byte) v);
         } else if (v instanceof byte[]) {
           byte[] array = (byte[]) v;
           message.setBytes(name, array, 0, array.length);
         } else {
           message.setObject(name, v);
         }
       }
     } catch (JMSException e) {
       throw new MessageFormatRuntimeException(e.getMessage());
     }
   }
   send(destination, message);
   return this;
 }