@Override public byte[] getBytes(final String name) throws JMSException { return message.getBytes(name); }
public byte[] getBytes(String name) throws JMSException { return ((MapMessage) message).getBytes(name); }
public byte[] getBytes(String name) throws JMSException { return ((MapMessage) message).getBytes(name); }
/** * Get * @param name The name * @return The value * @exception JMSException Thrown if an error occurs */ public byte[] getBytes(final String name) throws JMSException { if (_log.isTraceEnabled()) { _log.trace("getBytes(" + name + ")"); } return ((MapMessage)_message).getBytes(name); }
/** * Get * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public byte[] getBytes(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getBytes(" + name + ")"); } return ((MapMessage) message).getBytes(name); }
/** * Get * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public byte[] getBytes(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getBytes(" + name + ")"); } return ((MapMessage) message).getBytes(name); }
/** * MessageListener回调函数. */ @Override public void onMessage(Message message) { try { MapMessage mapMessage = (MapMessage) message; // 打印消息详情 byte[] bytes = mapMessage.getBytes("json"); String json = new String(bytes,"utf-8"); CacheSyncMessage dto = binder.fromJson(json, CacheSyncMessage.class); cacheSyncManager.writeMQCount(dto); message.acknowledge(); } catch (Exception e) { log.error("处理消息时发生异常: [{}]", message.toString(), e); } } }
payloadContent=mapMessage.getBytes(fullPayloadPrefix+PAYLOAD_CONTENT_SUFFIX);
@Override protected void assertEquivalent(final Message m, final int mode, final boolean redelivery) throws JMSException { super.assertEquivalent(m, mode, redelivery); MapMessage mm = (MapMessage) m; ProxyAssertSupport.assertEquals(true, mm.getBoolean("boolean")); ProxyAssertSupport.assertEquals((byte) 3, mm.getByte("byte")); byte[] bytes = mm.getBytes("bytes"); ProxyAssertSupport.assertEquals((byte) 3, bytes[0]); ProxyAssertSupport.assertEquals((byte) 4, bytes[1]); ProxyAssertSupport.assertEquals((byte) 5, bytes[2]); ProxyAssertSupport.assertEquals((char) 6, mm.getChar("char")); ProxyAssertSupport.assertEquals(new Double(7.0), new Double(mm.getDouble("double"))); ProxyAssertSupport.assertEquals(new Float(8.0f), new Float(mm.getFloat("float"))); ProxyAssertSupport.assertEquals(9, mm.getInt("int")); ProxyAssertSupport.assertEquals(10L, mm.getLong("long")); ProxyAssertSupport.assertEquals("this is an object", mm.getObject("object")); ProxyAssertSupport.assertEquals((short) 11, mm.getShort("short")); ProxyAssertSupport.assertEquals("this is a string", mm.getString("string")); } }
private void receiveMapMessage(boolean useCore) throws Exception { MapMessage mapMessage = (MapMessage) receiveMessage(useCore); boolean booleanVal = mapMessage.getBoolean("boolean-type"); assertTrue(booleanVal); byte byteVal = mapMessage.getByte("byte-type"); assertEquals((byte) 10, byteVal); byte[] bytesVal = mapMessage.getBytes("bytes-type"); byte[] originVal = TEXT.getBytes(); assertEquals(originVal.length, bytesVal.length); for (int i = 0; i < bytesVal.length; i++) { assertTrue(bytesVal[i] == originVal[i]); } char charVal = mapMessage.getChar("char-type"); assertEquals('A', charVal); double doubleVal = mapMessage.getDouble("double-type"); assertEquals(55.3D, doubleVal, 0.1D); float floatVal = mapMessage.getFloat("float-type"); assertEquals(79.1F, floatVal, 0.1F); int intVal = mapMessage.getInt("int-type"); assertEquals(37, intVal); long longVal = mapMessage.getLong("long-type"); assertEquals(56652L, longVal); Object objectVal = mapMessage.getObject("object-type"); Object origVal = new String("VVVV"); assertTrue(objectVal.equals(origVal)); short shortVal = mapMessage.getShort("short-type"); assertEquals((short) 333, shortVal); String strVal = mapMessage.getString("string-type"); assertEquals(TEXT, strVal); }
byte[] bytes = mapMessage.getBytes("abytes"); assertEquals(2, bytes.length); assertEquals((byte) 4, bytes[0]);
byte[] bytes = mapMessage.getBytes("abytes"); assertEquals(2, bytes.length); assertEquals((byte) 4, bytes[0]);