本文整理汇总了Java中org.apache.qpid.proton.engine.Delivery.settle方法的典型用法代码示例。如果您正苦于以下问题:Java Delivery.settle方法的具体用法?Java Delivery.settle怎么用?Java Delivery.settle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.engine.Delivery
的用法示例。
在下文中一共展示了Delivery.settle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDelivery
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onDelivery(Event evt) {
Delivery dlv = evt.getDelivery();
Link link = dlv.getLink();
if (link instanceof Sender) {
dlv.settle();
} else {
Receiver rcv = (Receiver) link;
if (!dlv.isPartial()) {
byte[] bytes = new byte[dlv.pending()];
rcv.recv(bytes, 0, bytes.length);
String address = router.getAddress(rcv);
Message message = new Message(bytes);
messages.put(address, message);
dlv.disposition(Accepted.getInstance());
dlv.settle();
if (!quiet) {
System.out.println(String.format("Got message(%s): %s", address, message));
}
send(address);
}
}
}
示例2: onDelivery
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onDelivery(Event evt) {
Delivery dlv = evt.getDelivery();
if (dlv.getLink() instanceof Receiver) {
Receiver receiver = (Receiver) dlv.getLink();
if (!dlv.isPartial()) {
byte[] bytes = new byte[dlv.pending()];
receiver.recv(bytes, 0, bytes.length);
Message msg = new Message(bytes);
if (!quiet) {
System.out.println(String.format("Got message: %s", msg));
}
received++;
dlv.settle();
}
if ((received >= count) || (!block && !receiver.draining())) {
receiver.getSession().getConnection().close();
}
}
}
示例3: onLinkFlow
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onLinkFlow(Event event) {
Sender snd = (Sender)event.getLink();
if (snd.getCredit() > 0) {
byte[] msgData = new byte[1024];
int length;
while(true) {
try {
length = message.encode(msgData, 0, msgData.length);
break;
} catch(BufferOverflowException e) {
msgData = new byte[msgData.length * 2];
}
}
byte[] tag = String.valueOf(nextTag++).getBytes();
Delivery dlv = snd.delivery(tag);
snd.send(msgData, 0, length);
dlv.settle();
snd.advance();
snd.close();
snd.getSession().close();
snd.getSession().getConnection().close();
}
}
示例4: settle
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
void settle(long sequence, boolean cumilative, boolean write) {
long count = cumilative ? _lastSettled.get() : sequence;
long end = sequence;
while (count <= end) {
Delivery d = _unsettled.get(count);
if (d != null) {
if (!d.isSettled() && d.getLink().getReceiverSettleMode() == ReceiverSettleMode.FIRST) {
d.settle();
((IncomingLinkImpl) d.getLink().getContext()).decrementUnsettledCount();
_unsettled.remove(count);
}
}
count++;
}
_lastSettled.set(end);
_conn.write();
}
示例5: send
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
TrackerImpl send(org.apache.qpid.proton.message.Message m) throws MessageFormatException, MessagingException {
checkClosed();
Sender sender = (Sender) _link;
byte[] tag = longToBytes(_ssn.getNextDeliveryTag());
Delivery delivery = sender.delivery(tag);
TrackerImpl tracker = new TrackerImpl(_ssn);
delivery.setContext(tracker);
if (m.getAddress() == null) {
m.setAddress(_address);
}
byte[] buffer = new byte[1024];
int encoded = m.encode(buffer, 0, buffer.length);
sender.send(buffer, 0, encoded);
if (sender.getSenderSettleMode() == SenderSettleMode.SETTLED) {
delivery.settle();
tracker.markSettled();
}
sender.advance();
_ssn.getConnection().write();
return tracker;
}
示例6: settle
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
void settle(InboundMessage msg, boolean cumilative, boolean write) throws NetworkException
{
long count = cumilative ? _lastSettled.get() : msg.getSequence();
long end = msg.getSequence();
while (count <= end)
{
Delivery d = _unsettled.get(count);
if (d != null)
{
if (!d.isSettled() && d.getLink().getReceiverSettleMode() == ReceiverSettleMode.FIRST)
{
d.settle();
((InboundLinkImpl) d.getLink().getContext()).decrementUnsettledCount();
_unsettled.remove(count);
}
}
count++;
}
_lastSettled.set(end);
_conn.write();
}
示例7: releasePrefetch
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
private void releasePrefetch() {
Delivery delivery = getEndpoint().head();
while (delivery != null) {
Delivery current = delivery;
delivery = delivery.next();
if (!(current.getContext() instanceof JmsInboundMessageDispatch)) {
LOG.debug("{} Found incomplete delivery with no context during release processing", AmqpConsumer.this);
continue;
}
JmsInboundMessageDispatch envelope = (JmsInboundMessageDispatch) current.getContext();
if (!envelope.isDelivered()) {
current.disposition(Released.getInstance());
current.settle();
}
}
}
示例8: send
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
private int send(String address, Sender snd) {
if (snd == null) {
Router.Routes<Sender> routes = router.getOutgoing(address);
snd = routes.choose();
if (snd == null) {
return 0;
}
}
int count = 0;
while (snd.getCredit() > 0 && snd.getQueued() < 1024) {
Message msg = messages.get(address);
if (msg == null) {
snd.drained();
return count;
}
Delivery dlv = snd.delivery(nextTag());
byte[] bytes = msg.getBytes();
snd.send(bytes, 0, bytes.length);
dlv.settle();
count++;
if (!quiet) {
System.out.println(String.format("Sent message(%s): %s", address, msg));
}
}
return count;
}
示例9: onDelivery
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onDelivery(Event evt) {
Delivery dlv = evt.getDelivery();
if (dlv.remotelySettled()) {
if (!quiet) {
System.out.println(String.format("Settled %s: %s", new String(dlv.getTag()), dlv.getRemoteState()));
}
dlv.settle();
settled++;
}
if (settled >= count) {
dlv.getLink().getSession().getConnection().close();
}
}
示例10: onDelivery
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onDelivery(Event event) {
Delivery dlv = event.getDelivery();
if (!dlv.isPartial()) {
dlv.settle();
++received;
}
}
示例11: onLinkFlow
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onLinkFlow(Event event) {
Sender link = (Sender)event.getLink();
while (link.getCredit() > 0 && remaining > 0) {
Delivery dlv = link.delivery(new byte[0]);
assertNotNull(dlv);
dlv.settle();
link.advance();
--remaining;
}
if (remaining == 0) {
event.getConnection().close();
}
}
示例12: deliveryFailed
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
protected void deliveryFailed(Delivery incoming, boolean expandCredit) {
Modified disposition = new Modified();
disposition.setUndeliverableHere(true);
disposition.setDeliveryFailed(true);
incoming.disposition(disposition);
incoming.settle();
if (expandCredit) {
getEndpoint().flow(1);
}
}
示例13: doSend
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
private void doSend(AmqpMessage message, AsyncResult request, AmqpTransactionId txId) throws Exception {
LOG.trace("Producer sending message: {}", message);
Delivery delivery = null;
if (presettle) {
delivery = getEndpoint().delivery(EMPTY_BYTE_ARRAY, 0, 0);
} else {
byte[] tag = tagGenerator.getNextTag();
delivery = getEndpoint().delivery(tag, 0, tag.length);
}
delivery.setContext(request);
Binary amqpTxId = null;
if (txId != null) {
amqpTxId = txId.getRemoteTxId();
} else if (session.isInTransaction()) {
amqpTxId = session.getTransactionId().getRemoteTxId();
}
if (amqpTxId != null) {
TransactionalState state = new TransactionalState();
state.setTxnId(amqpTxId);
delivery.disposition(state);
}
encodeAndSend(message.getWrappedMessage(), delivery);
if (presettle) {
delivery.settle();
request.onSuccess();
} else {
pending.add(delivery);
getEndpoint().advance();
}
}
示例14: settle
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
public void settle(Delivery delivery) {
connection.lock();
try {
delivery.settle();
} finally {
connection.unlock();
}
}
示例15: onFlow
import org.apache.qpid.proton.engine.Delivery; //导入方法依赖的package包/类
@Override
public void onFlow(Link link) {
if (link instanceof Sender) {
Sender snd = (Sender) link;
while (snd.getCredit() > 0 && snd.getQueued() < 1024) {
Delivery dlv = snd.delivery(nextTag());
dlv.settle();
sent++;
}
}
}