List of usage examples for javax.jms MapMessage setFloat
void setFloat(String name, float value) throws JMSException;
From source file:com.espertech.esperio.jms.JMSDefaultMapMessageMarshaller.java
public Message marshal(EventBean eventBean, Session session, long timestamp) throws EPException { EventType eventType = eventBean.getEventType(); MapMessage mapMessage = null; try {/*w ww . j a v a 2 s.c o m*/ mapMessage = session.createMapMessage(); String[] properties = eventType.getPropertyNames(); for (String property : properties) { if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug( ".Marshal EventProperty property==" + property + ", value=" + eventBean.get(property)); } Class clazz = eventType.getPropertyType(property); if (JavaClassHelper.isNumeric(clazz)) { Class boxedClazz = JavaClassHelper.getBoxedType(clazz); if (boxedClazz == Double.class) { mapMessage.setDouble(property, (Double) eventBean.get(property)); } if (boxedClazz == Float.class) { mapMessage.setFloat(property, (Float) eventBean.get(property)); } if (boxedClazz == Byte.class) { mapMessage.setFloat(property, (Byte) eventBean.get(property)); } if (boxedClazz == Short.class) { mapMessage.setShort(property, (Short) eventBean.get(property)); } if (boxedClazz == Integer.class) { mapMessage.setInt(property, (Integer) eventBean.get(property)); } if (boxedClazz == Long.class) { mapMessage.setLong(property, (Long) eventBean.get(property)); } } else if ((clazz == boolean.class) || (clazz == Boolean.class)) { mapMessage.setBoolean(property, (Boolean) eventBean.get(property)); } else if ((clazz == Character.class) || (clazz == char.class)) { mapMessage.setChar(property, (Character) eventBean.get(property)); } else if (clazz == String.class) { mapMessage.setString(property, (String) eventBean.get(property)); } else { mapMessage.setObject(property, eventBean.get(property)); } } mapMessage.setJMSTimestamp(timestamp); } catch (JMSException ex) { throw new EPException(ex); } return mapMessage; }
From source file:org.jbpm.bpel.tutorial.invoice.ComputePricePT_Impl.java
protected void sendInvoiceMessage(float shippingPrice) throws JMSException { ServletContext servletContext = endpointContext.getServletContext(); Integer orderId = (Integer) servletContext.getAttribute(ORDER_ID_ATTR); Float linePrice = (Float) servletContext.getAttribute(LINE_PRICE_ATTR); float amount = linePrice.floatValue() + shippingPrice; // create a session Session jmsSession = jmsConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE); try {//from w w w . ja va 2 s . c o m // create the message MapMessage invoiceMessage = jmsSession.createMapMessage(); invoiceMessage.setInt("orderId", orderId.intValue()); invoiceMessage.setFloat("amount", amount); // send it! MessageProducer producer = jmsSession.createProducer(invoiceDestination); producer.send(invoiceMessage); log.debug("Sent invoice message: orderId=" + orderId + ", amount=" + amount); } finally { jmsSession.close(); } }