本文整理汇总了Java中org.apache.qpid.proton.amqp.messaging.Source.setAddress方法的典型用法代码示例。如果您正苦于以下问题:Java Source.setAddress方法的具体用法?Java Source.setAddress怎么用?Java Source.setAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.qpid.proton.amqp.messaging.Source
的用法示例。
在下文中一共展示了Source.setAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConsumeWhenOnlyAnycast
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testConsumeWhenOnlyAnycast() throws Exception {
server.addAddressInfo(new AddressInfo(address, RoutingType.ANYCAST));
sendMessages(address.toString(), 1);
AmqpClient client = createAmqpClient();
AmqpConnection connection = addConnection(client.connect());
AmqpSession session = connection.createSession();
Source jmsSource = createJmsSource(true);
jmsSource.setAddress(address.toString());
try {
session.createReceiver(jmsSource);
fail("should throw exception");
} catch (Exception e) {
//ignore
}
connection.close();
}
示例2: testConsumeWhenOnlyMulticast
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testConsumeWhenOnlyMulticast() throws Exception {
server.addAddressInfo(new AddressInfo(address, RoutingType.MULTICAST));
sendMessages(address.toString(), 1);
AmqpClient client = createAmqpClient();
AmqpConnection connection = addConnection(client.connect());
AmqpSession session = connection.createSession();
Source jmsSource = createJmsSource(false);
jmsSource.setAddress(address.toString());
try {
session.createReceiver(jmsSource);
fail("should throw exception");
} catch (Exception e) {
//ignore
}
connection.close();
}
示例3: doOpen
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected void doOpen() {
String sourceAddress = info.getName();
if (info.isQueue()) {
sourceAddress = connection.getTempQueuePrefix() + sourceAddress;
} else {
sourceAddress = connection.getTempQueuePrefix() + sourceAddress;
}
Source source = new Source();
source.setAddress(sourceAddress);
Target target = new Target();
target.setDynamic(true);
String senderName = sourceAddress;
endpoint = session.getProtonSession().sender(senderName);
endpoint.setSource(source);
endpoint.setTarget(target);
endpoint.setSenderSettleMode(SenderSettleMode.UNSETTLED);
endpoint.setReceiverSettleMode(ReceiverSettleMode.FIRST);
this.connection.addTemporaryDestination(this);
}
示例4: doOpen
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected void doOpen() {
JmsDestination destination = info.getDestination();
String destnationName = session.getQualifiedName(destination);
String sourceAddress = getProducerId().toString();
Source source = new Source();
source.setAddress(sourceAddress);
Target target = new Target();
target.setAddress(destnationName);
String senderName = sourceAddress + ":" + destnationName != null ? destnationName : "Anonymous";
endpoint = session.getProtonSession().sender(senderName);
endpoint.setSource(source);
endpoint.setTarget(target);
if (presettle) {
endpoint.setSenderSettleMode(SenderSettleMode.SETTLED);
} else {
endpoint.setSenderSettleMode(SenderSettleMode.UNSETTLED);
}
endpoint.setReceiverSettleMode(ReceiverSettleMode.FIRST);
}
示例5: testOnLinkAttachClosesSenderWithoutAppropriateReplyAddress
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
/**
* Verifies that the endpoint closes a sender that does not contain a source address
* that is not suitable as a reply-to-address.
*/
@Test
public void testOnLinkAttachClosesSenderWithoutAppropriateReplyAddress() {
Source source = new Source();
source.setAddress("endpoint/" + Constants.DEFAULT_TENANT); // not a suitable reply-to-address: missing resource ID
when(sender.getRemoteSource()).thenReturn(source);
RequestResponseEndpoint<ServiceConfigProperties> endpoint = getEndpoint(true);
endpoint.onLinkAttach(connection, sender, resource);
verify(sender).setCondition(any());
verify(sender).close();
}
示例6: createSender
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private void createSender(org.apache.qpid.proton.engine.Session session) throws Exception {
Sender sender = session.sender(subscriberInfo.getClientId());
Target target = new Target();
target.setAddress(subscriberInfo.getClientAddress());
sender.setTarget(target);
Source source = new Source();
source.setAddress(subscriberInfo.getClientAddress());
source.setDurable(TerminusDurability.UNSETTLED_STATE);
sender.setSource(source);
sender.open();
}
示例7: createSender
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private void createSender(ProtonConnection connection, ProtonSender sender) {
Source source = (Source) sender.getRemoteSource();
if (source.getDynamic()) {
String replyAddress = UUID.randomUUID().toString();
replyHandlers.put(replyAddress, new HandlerContext(connection, sender, replyAddress));
sender.closeHandler(res -> replyHandlers.remove(replyAddress));
source.setAddress(replyAddress);
sender.setSource(source);
}
sender.open();
}
示例8: newOutgoing
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
public Sender newOutgoing(Session ssn, String remote, String local) {
Sender snd = ssn.sender(String.format("%s-%s", local, remote));
Source src = new Source();
src.setAddress(local);
snd.setSource(src);
Target tgt = new Target();
tgt.setAddress(remote);
snd.setTarget(tgt);
return snd;
}
示例9: newIncoming
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
public Receiver newIncoming(Session ssn, String remote, String local) {
Receiver rcv = ssn.receiver(String.format("%s-%s", remote, local));
Source src = new Source();
src.setAddress(remote);
rcv.setSource(src);
Target tgt = new Target();
tgt.setAddress(remote);
rcv.setTarget(tgt);
return rcv;
}
示例10: testClientIdIsSetInSubscriptionList
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testClientIdIsSetInSubscriptionList() throws Exception {
server.addAddressInfo(new AddressInfo(SimpleString.toSimpleString("mytopic"), RoutingType.ANYCAST));
AmqpClient client = createAmqpClient();
AmqpConnection connection = addConnection(client.connect());
connection.setContainerId("testClient");
connection.connect();
try {
AmqpSession session = connection.createSession();
Source source = new Source();
source.setDurable(TerminusDurability.UNSETTLED_STATE);
source.setCapabilities(Symbol.getSymbol("topic"));
source.setAddress("mytopic");
session.createReceiver(source, "testSub");
SimpleString fo = new SimpleString("testClient.testSub:mytopic");
assertNotNull(server.locateQueue(fo));
} catch (Exception e) {
e.printStackTrace();
} finally {
connection.close();
}
}
示例11: createNonSharedSource
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createNonSharedSource(TerminusDurability terminusDurability) {
Source source = new Source();
source.setAddress(address.toString());
source.setCapabilities(TOPIC_CAPABILITY);
source.setDurable(terminusDurability);
return source;
}
示例12: createSharedSource
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createSharedSource(TerminusDurability terminusDurability) {
Source source = new Source();
source.setAddress(address.toString());
source.setCapabilities(TOPIC_CAPABILITY, SHARED);
source.setDurable(terminusDurability);
return source;
}
示例13: createSharedGlobalSource
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
private Source createSharedGlobalSource(TerminusDurability terminusDurability) {
Source source = new Source();
source.setAddress(address.toString());
source.setCapabilities(TOPIC_CAPABILITY, SHARED, GLOBAL);
source.setDurable(terminusDurability);
return source;
}
示例14: createReceiver
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
public ProtonReceiver createReceiver(String address, ProtonLinkOptions receiverOptions) {
Receiver receiver = session.receiver(getOrCreateLinkName(receiverOptions));
Symbol[] outcomes = new Symbol[] { Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL,
Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
Source source = new Source();
source.setAddress(address);
source.setOutcomes(outcomes);
source.setDefaultOutcome(Released.getInstance());
Target target = new Target();
receiver.setSource(source);
receiver.setTarget(target);
ProtonReceiverImpl r = new ProtonReceiverImpl(receiver);
r.openHandler((result) -> {
LOG.trace("Receiver open completed");
});
r.closeHandler((result) -> {
if (result.succeeded()) {
LOG.trace("Receiver closed");
} else {
LOG.warn("Receiver closed with error", result.cause());
}
});
// Default to at-least-once
r.setQoS(ProtonQoS.AT_LEAST_ONCE);
return r;
}
示例15: createEndpoint
import org.apache.qpid.proton.amqp.messaging.Source; //导入方法依赖的package包/类
@Override
protected Sender createEndpoint(JmsProducerInfo resourceInfo) {
JmsDestination destination = resourceInfo.getDestination();
AmqpConnection connection = getParent().getConnection();
String targetAddress = AmqpDestinationHelper.INSTANCE.getDestinationAddress(destination, connection);
Symbol[] outcomes = new Symbol[]{ Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL };
String sourceAddress = resourceInfo.getId().toString();
Source source = new Source();
source.setAddress(sourceAddress);
source.setOutcomes(outcomes);
// TODO: default outcome. Accepted normally, Rejected for transaction controller?
Target target = new Target();
target.setAddress(targetAddress);
Symbol typeCapability = AmqpDestinationHelper.INSTANCE.toTypeCapability(destination);
if (typeCapability != null) {
target.setCapabilities(typeCapability);
}
String senderName = "qpid-jms:sender:" + sourceAddress + ":" + targetAddress;
Sender sender = getParent().getEndpoint().sender(senderName);
sender.setSource(source);
sender.setTarget(target);
if (resourceInfo.isPresettle()) {
sender.setSenderSettleMode(SenderSettleMode.SETTLED);
} else {
sender.setSenderSettleMode(SenderSettleMode.UNSETTLED);
}
sender.setReceiverSettleMode(ReceiverSettleMode.FIRST);
if (!connection.getProperties().isDelayedDeliverySupported()) {
validateDelayedDeliveryLinkCapability = true;
sender.setDesiredCapabilities(new Symbol[] { AmqpSupport.DELAYED_DELIVERY });
}
return sender;
}