Java Code Examples for org.apache.qpid.proton.message.impl.MessageImpl#decode()
The following examples show how to use
org.apache.qpid.proton.message.impl.MessageImpl#decode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtonTransactionHandler.java From activemq-artemis with Apache License 2.0 | 4 votes |
private MessageImpl decodeMessage(ByteBuffer encoded) { MessageImpl message = (MessageImpl) Message.Factory.create(); message.decode(encoded); return message; }
Example 2
Source File: ProtonReceiverImpl.java From vertx-proton with Apache License 2.0 | 4 votes |
void onDelivery() { if (this.handler == null) { return; } Receiver receiver = getReceiver(); Delivery delivery = receiver.current(); if (delivery != null) { if(delivery.isAborted()) { handleAborted(receiver, delivery); return; } if (delivery.isPartial()) { handlePartial(receiver, delivery); // Delivery is not yet completely received, // return and allow further frames to arrive. return; } // Complete prior partial content if needed, or grab it all. ReadableBuffer data = receiver.recv(); if(splitContent != null) { data = completePartial(data); } receiver.advance(); MessageImpl msg = (MessageImpl) Proton.message(); ProtonDeliveryImpl delImpl = new ProtonDeliveryImpl(delivery); try { msg.decode(data); } catch (Throwable t) { LOG.debug("Unable to decode message, undeliverable", t); handleDecodeFailure(receiver, delImpl); return; } handler.handle(delImpl, msg); if (autoAccept && delivery.getLocalState() == null) { accepted(delImpl, true); } if (prefetch > 0) { // Replenish credit if prefetch is configured. // TODO: batch credit replenish, optionally flush if exceeding a given threshold? flow(1, false); } else { processForDrainCompletion(); } } }