本文整理汇总了Java中org.apache.qpid.proton.engine.Receiver.setSenderSettleMode方法的典型用法代码示例。如果您正苦于以下问题:Java Receiver.setSenderSettleMode方法的具体用法?Java Receiver.setSenderSettleMode怎么用?Java Receiver.setSenderSettleMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.engine.Receiver
的用法示例。
在下文中一共展示了Receiver.setSenderSettleMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInboundLink
import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
public IncomingLink createInboundLink(String address, ReliabilityMode mode, CreditMode creditMode)
throws MessagingException {
checkClosed();
String name = UUID.randomUUID().toString();
Receiver receiver = _ssn.receiver(name);
Source source = new Source();
// Target target = new Target();
if (address == null || address.isEmpty() || address.equals("#")) {
source.setDynamic(true);
} else {
source.setAddress(address);
}
receiver.setSource(source);
// receiver.setTarget(target);
switch (mode) {
case UNRELIABLE:
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
break;
case AT_LEAST_ONCE:
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
break;
// case EXACTLY_ONCE:
// receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND);
// receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
// break;
}
receiver.open();
IncomingLinkImpl inLink = new IncomingLinkImpl(this, address, receiver, mode, creditMode);
inLink.setDynamicAddress(source.getDynamic());
_links.put(receiver, inLink);
receiver.setContext(inLink);
return inLink;
}
示例2: createEndpoint
import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
protected Receiver createEndpoint(JmsSessionInfo resourceInfo) {
Receiver receiver = getParent().getEndpoint().receiver(linkName);
receiver.setTarget(new Target());
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
if (!hasClientID) {
// We are trying to unsubscribe a 'global' shared subs using a 'null source lookup', add link
// desired capabilities as hints to the peer to consider this when trying to attach the link.
receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED, AmqpSupport.GLOBAL });
}
return receiver;
}
示例3: createInboundLink
import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
public InboundLink createInboundLink(String address, InboundLinkMode mode, CreditMode creditMode)
throws NetworkException, MessagingException
{
Receiver receiver;
Source source = new Source();
Target target = new Target();
if (address == null || address.isEmpty() || address.equals("#"))
{
String temp = UUID.randomUUID().toString();
receiver = _ssn.receiver(temp);
source.setDynamic(true);
}
else
{
receiver = _ssn.receiver(address);
source.setAddress(address);
}
receiver.setSource(source);
receiver.setTarget(target);
switch (mode)
{
case AT_MOST_ONCE:
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
break;
case AT_LEAST_ONCE:
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
break;
case EXACTLY_ONCE:
receiver.setReceiverSettleMode(ReceiverSettleMode.SECOND);
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
break;
}
receiver.open();
InboundLinkImpl inLink = new InboundLinkImpl(this, address, receiver, creditMode);
inLink.setDynamicAddress(source.getDynamic());
_links.put(receiver, inLink);
receiver.setContext(inLink);
_conn.write();
return inLink;
}
示例4: createEndpoint
import org.apache.qpid.proton.engine.Receiver; //导入方法依赖的package包/类
@Override
protected Receiver createEndpoint(JmsConsumerInfo resourceInfo) {
JmsDestination destination = resourceInfo.getDestination();
String address = AmqpDestinationHelper.INSTANCE.getDestinationAddress(destination, getParent().getConnection());
Source source = new Source();
source.setAddress(address);
Target target = new Target();
configureSource(source);
String receiverLinkName = null;
String subscriptionName = resourceInfo.getSubscriptionName();
if (subscriptionName != null && !subscriptionName.isEmpty()) {
AmqpConnection connection = getParent().getConnection();
if (resourceInfo.isShared() && !connection.getProperties().isSharedSubsSupported()) {
validateSharedSubsLinkCapability = true;
}
AmqpSubscriptionTracker subTracker = connection.getSubTracker();
// Validate subscriber type allowed given existing active subscriber types.
if (resourceInfo.isShared() && resourceInfo.isDurable()) {
if(subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
// Don't allow shared sub if there is already an active exclusive durable sub
throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
}
} else if (!resourceInfo.isShared() && resourceInfo.isDurable()) {
if (subTracker.isActiveExclusiveDurableSub(subscriptionName)) {
// Exclusive durable sub is already active
throw new JMSRuntimeException("A non-shared durable subscription is already active with name '" + subscriptionName + "'");
} else if (subTracker.isActiveSharedDurableSub(subscriptionName)) {
// Don't allow exclusive durable sub if there is already an active shared durable sub
throw new JMSRuntimeException("A shared durable subscription is already active with name '" + subscriptionName + "'");
}
}
// Get the link name for the subscription. Throws if certain further validations fail.
receiverLinkName = subTracker.reserveNextSubscriptionLinkName(subscriptionName, resourceInfo);
}
if(receiverLinkName == null) {
receiverLinkName = "qpid-jms:receiver:" + resourceInfo.getId() + ":" + address;
}
Receiver receiver = getParent().getEndpoint().receiver(receiverLinkName);
receiver.setSource(source);
receiver.setTarget(target);
if (resourceInfo.isBrowser() || resourceInfo.isPresettle()) {
receiver.setSenderSettleMode(SenderSettleMode.SETTLED);
} else {
receiver.setSenderSettleMode(SenderSettleMode.UNSETTLED);
}
receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST);
if(validateSharedSubsLinkCapability) {
receiver.setDesiredCapabilities(new Symbol[] { AmqpSupport.SHARED_SUBS });
}
return receiver;
}