@Override public void encodeRest(final ActiveMQBuffer buffer) { buffer.writeInt(exception.getType().getCode()); buffer.writeNullableString(exception.getMessage()); }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
public static void setJMSCorrelationID(Message message, final String correlationID) { if (correlationID == null) { message.removeProperty(CORRELATIONID_HEADER_NAME); } else { message.putStringProperty(CORRELATIONID_HEADER_NAME, new SimpleString(correlationID)); } }
/** Sub classes must add the first short as the protocol-id */ @Override public void encode(ActiveMQBuffer buffer, Message record) { buffer.writeByte((byte)1); buffer.writeLong(record.getMessageID()); buffer.writeNullableSimpleString(record.getAddressSimpleString()); record.persist(buffer); }
@Override public void encodeRest(ActiveMQBuffer buffer) { message.sendBuffer(buffer.byteBuf(), deliveryCount); buffer.writeLong(consumerID); buffer.writeInt(deliveryCount); }
@Override public void encodeRest(ActiveMQBuffer buffer) { message.sendBuffer_1X(buffer.byteBuf()); buffer.writeLong(consumerID); buffer.writeInt(deliveryCount); }
public static void writeAsNullableSimpleString(ActiveMQBuffer buffer, String str) { buffer.writeNullableSimpleString(SimpleString.toSimpleString(str)); }
public static String readNullableSimpleStringAsString(ActiveMQBuffer buffer) { SimpleString str = buffer.readNullableSimpleString(); return str != null ? str.toString() : null; }
/** * Stores a resource attribute in a message to retrieve the value from the server resource. * * @param message message * @param resourceName the name of the resource * @param attribute the name of the attribute * @see ResourceNames */ public static void putAttribute(final ICoreMessage message, final String resourceName, final String attribute) { message.putStringProperty(ManagementHelper.HDR_RESOURCE_NAME, new SimpleString(resourceName)); message.putStringProperty(ManagementHelper.HDR_ATTRIBUTE, new SimpleString(attribute)); }
public static SimpleString toSimpleString(final String string, StringSimpleStringPool pool) { if (pool == null) { return toSimpleString(string); } return pool.getOrCreate(string); }
/** * Creates a <em>self-expanding</em> ActiveMQBuffer filled with the given byte array * * @param bytes the created buffer will be initially filled with this byte array * @return a self-expanding ActiveMQBuffer filled with the given byte array */ public static ActiveMQBuffer dynamicBuffer(final byte[] bytes) { ActiveMQBuffer buff = dynamicBuffer(bytes.length); buff.writeBytes(bytes); return buff; }
public static String getJMSType(Message message) { SimpleString ss = message.getSimpleStringProperty(TYPE_HEADER_NAME); if (ss != null) { return ss.toString(); } else { return null; } }
@Override public void encodeRest(ActiveMQBuffer buffer) { message.sendBuffer(buffer.byteBuf(), 0); buffer.writeBoolean(requiresResponse); }
@Override public void decodeRest(final ActiveMQBuffer buffer) { int code = buffer.readInt(); String msg = buffer.readNullableString(); exception = ActiveMQExceptionType.createException(code, msg); }
@Override public void encodeRest(ActiveMQBuffer buffer) { message.sendBuffer_1X(buffer.byteBuf()); buffer.writeBoolean(requiresResponse); }
@Override public int getEncodeSize(Message record) { return DataConstants.SIZE_BYTE + record.getPersistSize() + SimpleString.sizeofNullableString(record.getAddressSimpleString()) + DataConstants.SIZE_LONG; }
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
public static SimpleString readSimpleString(ByteBuf buffer, ByteBufSimpleStringPool pool) { if (pool == null) { return readSimpleString(buffer); } return pool.getOrCreate(buffer); }
@Override public ActiveMQException createException(String msg) { return new ActiveMQRemoteDisconnectException(msg); } },
@Override public ActiveMQException createException(String msg) { return new ActiveMQQueueMaxConsumerLimitReached(msg); } },