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

    ((MapMessage) message).setDouble(name, value);
  }
 @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;
 }
  protected Message createStockMessage(String stock, Session session) throws JMSException {
    Double value = LAST_PRICES.get(stock);
    if (value == null) {
      value = new Double(Math.random() * 100);
    }

    // lets mutate the value by some percentage
    double oldPrice = value.doubleValue();
    value = new Double(mutatePrice(oldPrice));
    LAST_PRICES.put(stock, value);
    double price = value.doubleValue();

    double offer = price * 1.001;

    boolean up = (price > oldPrice);
    MapMessage message = session.createMapMessage();
    message.setString("stock", stock);
    message.setDouble("price", price);
    message.setDouble("offer", offer);
    message.setBoolean("up", up);
    return message;
  }