本文整理汇总了Java中org.apache.activemq.command.ActiveMQDestination.TOPIC_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQDestination.TOPIC_TYPE属性的具体用法?Java ActiveMQDestination.TOPIC_TYPE怎么用?Java ActiveMQDestination.TOPIC_TYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.activemq.command.ActiveMQDestination
的用法示例。
在下文中一共展示了ActiveMQDestination.TOPIC_TYPE属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEndpoint
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
BrokerConfiguration brokerConfiguration = new BrokerConfiguration();
setProperties(brokerConfiguration, parameters);
byte destinationType = ActiveMQDestination.QUEUE_TYPE;
if (remaining.startsWith(JmsConfiguration.QUEUE_PREFIX)) {
remaining = removeStartingCharacters(remaining.substring(JmsConfiguration.QUEUE_PREFIX.length()), '/');
} else if (remaining.startsWith(JmsConfiguration.TOPIC_PREFIX)) {
destinationType = ActiveMQDestination.TOPIC_TYPE;
remaining = removeStartingCharacters(remaining.substring(JmsConfiguration.TOPIC_PREFIX.length()), '/');
} else if (remaining.startsWith(JmsConfiguration.TEMP_QUEUE_PREFIX)) {
destinationType = ActiveMQDestination.TEMP_QUEUE_TYPE;
remaining = removeStartingCharacters(remaining.substring(JmsConfiguration.TEMP_QUEUE_PREFIX.length()), '/');
} else if (remaining.startsWith(JmsConfiguration.TEMP_TOPIC_PREFIX)) {
destinationType = ActiveMQDestination.TEMP_TOPIC_TYPE;
remaining = removeStartingCharacters(remaining.substring(JmsConfiguration.TEMP_TOPIC_PREFIX.length()), '/');
}
ActiveMQDestination destination = ActiveMQDestination.createDestination(remaining, destinationType);
BrokerEndpoint brokerEndpoint = new BrokerEndpoint(uri, this, destination, brokerConfiguration);
return brokerEndpoint;
}
示例2: convert
KahaDestination convert(ActiveMQDestination dest) {
KahaDestination rc = new KahaDestination();
rc.setName(dest.getPhysicalName());
switch (dest.getDestinationType()) {
case ActiveMQDestination.QUEUE_TYPE:
rc.setType(DestinationType.QUEUE);
return rc;
case ActiveMQDestination.TOPIC_TYPE:
rc.setType(DestinationType.TOPIC);
return rc;
case ActiveMQDestination.TEMP_QUEUE_TYPE:
rc.setType(DestinationType.TEMP_QUEUE);
return rc;
case ActiveMQDestination.TEMP_TOPIC_TYPE:
rc.setType(DestinationType.TEMP_TOPIC);
return rc;
default:
return null;
}
}
示例3: convert
KahaDestination convert(ActiveMQDestination dest) {
KahaDestination rc = new KahaDestination();
rc.setName(dest.getPhysicalName());
switch( dest.getDestinationType() ) {
case ActiveMQDestination.QUEUE_TYPE:
rc.setType(DestinationType.QUEUE);
return rc;
case ActiveMQDestination.TOPIC_TYPE:
rc.setType(DestinationType.TOPIC);
return rc;
case ActiveMQDestination.TEMP_QUEUE_TYPE:
rc.setType(DestinationType.TEMP_QUEUE);
return rc;
case ActiveMQDestination.TEMP_TOPIC_TYPE:
rc.setType(DestinationType.TEMP_TOPIC);
return rc;
default:
return null;
}
}
示例4: createDestination
public ActiveMQDestination createDestination(Session session, byte type, String name) throws Exception {
if (name == null) {
return createDestination(session, type);
}
switch (type) {
case ActiveMQDestination.QUEUE_TYPE:
makeSureCoreQueueExist(name);
return (ActiveMQDestination) session.createQueue(name);
case ActiveMQDestination.TOPIC_TYPE:
return (ActiveMQDestination) session.createTopic(name);
case ActiveMQDestination.TEMP_QUEUE_TYPE:
return (ActiveMQDestination) session.createTemporaryQueue();
case ActiveMQDestination.TEMP_TOPIC_TYPE:
return (ActiveMQDestination) session.createTemporaryTopic();
default:
throw new IllegalArgumentException("type: " + type);
}
}
示例5: testCreateConsumer
/**
* Tests if a consumer can be created asynchronusly
*
* @throws Exception
*/
@Test
public void testCreateConsumer() throws Exception {
connection.setClientID("connection:" + "JmsCreateConsumerInOnMessageTest");
publisherSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
topic = (Topic) super.createDestination(consumerSession, ActiveMQDestination.TOPIC_TYPE);
consumer = consumerSession.createConsumer(topic);
consumer.setMessageListener(this);
producer = publisherSession.createProducer(topic);
connection.start();
Message msg = publisherSession.createMessage();
producer.send(msg);
System.out.println("message sent: " + msg);
synchronized (lock) {
long timeout = System.currentTimeMillis() + 3000;
while (testConsumer == null && timeout > System.currentTimeMillis()) {
lock.wait(1000);
}
}
assertTrue(testConsumer != null);
}
示例6: createDestination
protected ActiveMQDestination createDestination(Session session, byte type) throws JMSException {
String testMethod = getName();
if (testMethod.indexOf(" ") > 0) {
testMethod = testMethod.substring(0, testMethod.indexOf(" "));
}
String name = "TEST." + getClass().getName() + "." + testMethod + "." + TEST_COUNTER.getAndIncrement();
switch (type) {
case ActiveMQDestination.QUEUE_TYPE:
return (ActiveMQDestination) session.createQueue(name);
case ActiveMQDestination.TOPIC_TYPE:
return (ActiveMQDestination) session.createTopic(name);
case ActiveMQDestination.TEMP_QUEUE_TYPE:
return (ActiveMQDestination) session.createTemporaryQueue();
case ActiveMQDestination.TEMP_TOPIC_TYPE:
return (ActiveMQDestination) session.createTemporaryTopic();
default:
throw new IllegalArgumentException("type: " + type);
}
}
示例7: getACLs
protected Set<GroupPrincipal> getACLs(ActiveMQDestination destination, String roleBase, String roleAttribute) {
try {
context = open();
} catch (NamingException e) {
LOG.error(e.toString());
return new HashSet<GroupPrincipal>();
}
String destinationBase = "";
SearchControls constraints = new SearchControls();
if (AdvisorySupport.isAdvisoryTopic(destination) && useAdvisorySearchBase) {
destinationBase = advisorySearchBase;
} else {
if ((destination.getDestinationType() & ActiveMQDestination.QUEUE_TYPE) == ActiveMQDestination.QUEUE_TYPE) {
destinationBase = queueSearchMatchingFormat.format(new String[]{destination.getPhysicalName()});
if (queueSearchSubtreeBool) {
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
} else {
constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
}
}
if ((destination.getDestinationType() & ActiveMQDestination.TOPIC_TYPE) == ActiveMQDestination.TOPIC_TYPE) {
destinationBase = topicSearchMatchingFormat.format(new String[]{destination.getPhysicalName()});
if (topicSearchSubtreeBool) {
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
} else {
constraints.setSearchScope(SearchControls.ONELEVEL_SCOPE);
}
}
}
constraints.setReturningAttributes(new String[] {roleAttribute});
return getACLs(destinationBase, constraints, roleBase, roleAttribute);
}
示例8: getDestinationAdvisoryTopic
public static ActiveMQTopic getDestinationAdvisoryTopic(ActiveMQDestination destination) {
switch (destination.getDestinationType()) {
case ActiveMQDestination.QUEUE_TYPE:
return QUEUE_ADVISORY_TOPIC;
case ActiveMQDestination.TOPIC_TYPE:
return TOPIC_ADVISORY_TOPIC;
case ActiveMQDestination.TEMP_QUEUE_TYPE:
return TEMP_QUEUE_ADVISORY_TOPIC;
case ActiveMQDestination.TEMP_TOPIC_TYPE:
return TEMP_TOPIC_ADVISORY_TOPIC;
default:
throw new RuntimeException("Unknown destination type: " + destination.getDestinationType());
}
}
示例9: getRegion
protected Region getRegion(ActiveMQDestination destination) throws JMSException {
switch (destination.getDestinationType()) {
case ActiveMQDestination.QUEUE_TYPE:
return queueRegion;
case ActiveMQDestination.TOPIC_TYPE:
return topicRegion;
case ActiveMQDestination.TEMP_QUEUE_TYPE:
return tempQueueRegion;
case ActiveMQDestination.TEMP_TOPIC_TYPE:
return tempTopicRegion;
default:
throw createUnknownDestinationTypeException(destination);
}
}
示例10: createDestination2
protected ActiveMQDestination createDestination2(Session session, byte type) throws JMSException {
switch (type) {
case ActiveMQDestination.QUEUE_TYPE:
return (ActiveMQDestination) session.createQueue(queueName2);
case ActiveMQDestination.TOPIC_TYPE:
return (ActiveMQDestination) session.createTopic(topicName2);
case ActiveMQDestination.TEMP_QUEUE_TYPE:
return (ActiveMQDestination) session.createTemporaryQueue();
case ActiveMQDestination.TEMP_TOPIC_TYPE:
return (ActiveMQDestination) session.createTemporaryTopic();
default:
throw new IllegalArgumentException("type: " + type);
}
}
示例11: getDestinationType
@Override
public byte getDestinationType() {
return ActiveMQDestination.QUEUE_TYPE & ActiveMQDestination.TOPIC_TYPE;
}