本文整理了Java中org.apache.activemq.broker.Broker.addDestination()
方法的一些代码示例,展示了Broker.addDestination()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Broker.addDestination()
方法的具体详情如下:
包路径:org.apache.activemq.broker.Broker
类名称:Broker
方法名:addDestination
[英]Add and process a DestinationInfo object
[中]添加并处理DestinationInfo对象
代码示例来源:origin: apache/activemq
@Override
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
Destination result = next.addDestination(context, destination,createIfTemporary);
Broker brokers[] = getListeners();
for (int i = 0; i < brokers.length; i++) {
brokers[i].addDestination(context, destination,createIfTemporary);
}
return result;
}
代码示例来源:origin: apache/activemq
@Override
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
return getNext().addDestination(context, destination,createIfTemporary);
}
代码示例来源:origin: apache/activemq
/**
* Looks up and lazily creates if necessary the destination for the given
* JMS name
*/
public Destination getDestination(ActiveMQDestination destination) throws Exception {
return getBroker().addDestination(getAdminConnectionContext(), destination,false);
}
代码示例来源:origin: apache/activemq
protected Destination lookup(ConnectionContext context, ActiveMQDestination destination,boolean createTemporary) throws Exception {
Destination dest = null;
destinationsLock.readLock().lock();
try {
dest = destinations.get(destination);
} finally {
destinationsLock.readLock().unlock();
}
if (dest == null) {
if (isAutoCreateDestinations()) {
// Try to auto create the destination... re-invoke broker
// from the
// top so that the proper security checks are performed.
dest = context.getBroker().addDestination(context, destination, createTemporary);
}
if (dest == null) {
throw new JMSException("The destination " + destination + " does not exist.");
}
}
return dest;
}
代码示例来源:origin: apache/activemq
protected void importDestinations() throws Exception {
BufferedReader reader = null;
try {
if (location.exists()) {
reader = new BufferedReader(new FileReader(location));
String destination;
Broker broker = getBrokerService().getBroker();
while ((destination = reader.readLine()) != null) {
broker.addDestination(getBrokerService().getAdminConnectionContext(),
ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE),
true);
}
}
} catch (Exception e) {
LOG.warn("Exception loading destinations", e);
} finally {
if (reader != null) {
reader.close();
}
}
}
代码示例来源:origin: apache/activemq
@Override
public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
ActiveMQDestination destination = info.getDestination();
if (destination != null) {
inactiveDestinationsPurgeLock.readLock().lock();
try {
// This seems to cause the destination to be added but without
// advisories firing...
context.getBroker().addDestination(context, destination, isAllowTempAutoCreationOnSend());
getRegion(destination).addProducer(context, info);
} finally {
inactiveDestinationsPurgeLock.readLock().unlock();
}
}
}
代码示例来源:origin: apache/activemq
@Override
public final void start() throws Exception {
started = true;
Set<ActiveMQDestination> inactiveDests = getInactiveDestinations();
for (Iterator<ActiveMQDestination> iter = inactiveDests.iterator(); iter.hasNext();) {
ActiveMQDestination dest = iter.next();
ConnectionContext context = new ConnectionContext();
context.setBroker(broker.getBrokerService().getBroker());
context.setSecurityContext(SecurityContext.BROKER_SECURITY_CONTEXT);
context.getBroker().addDestination(context, dest, false);
}
destinationsLock.readLock().lock();
try{
for (Iterator<Destination> i = destinations.values().iterator(); i.hasNext();) {
Destination dest = i.next();
dest.start();
}
} finally {
destinationsLock.readLock().unlock();
}
}
代码示例来源:origin: apache/activemq
protected void startVirtualConsumerDestinations() throws Exception {
checkStartException();
ConnectionContext adminConnectionContext = getAdminConnectionContext();
Set<ActiveMQDestination> destinations = destinationFactory.getDestinations();
DestinationFilter filter = getVirtualTopicConsumerDestinationFilter();
if (!destinations.isEmpty()) {
for (ActiveMQDestination destination : destinations) {
if (filter.matches(destination) == true) {
broker.addDestination(adminConnectionContext, destination, false);
}
}
}
}
代码示例来源:origin: apache/activemq
/**
* Starts any configured destinations on startup
*/
protected void startDestinations() throws Exception {
if (destinations != null) {
ConnectionContext adminConnectionContext = getAdminConnectionContext();
for (int i = 0; i < destinations.length; i++) {
ActiveMQDestination destination = destinations[i];
getBroker().addDestination(adminConnectionContext, destination,true);
}
}
if (isUseVirtualTopics()) {
startVirtualConsumerDestinations();
}
}
代码示例来源:origin: apache/activemq
@Override
public void create(Broker broker, ConnectionContext context, ActiveMQDestination destination) throws Exception {
if (destination.isQueue() && destination.isPattern()) {
DestinationFilter filter = DestinationFilter.parseFilter(new ActiveMQQueue(prefix + DestinationFilter.ANY_DESCENDENT));
if (filter.matches(destination)) {
broker.addDestination(context, destination, false);
}
}
}
代码示例来源:origin: apache/activemq
@Override
public void addQueue(String name) throws Exception {
safeGetBroker().getContextBroker()
.addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQQueue(name), true);
}
代码示例来源:origin: apache/activemq
@Override
public void addTopic(String name) throws Exception {
safeGetBroker().getContextBroker()
.addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQTopic(name), true);
}
代码示例来源:origin: apache/activemq
@Override
public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception {
ActiveMQDestination destination = message.getDestination();
message.setBrokerInTime(System.currentTimeMillis());
if (producerExchange.isMutable() || producerExchange.getRegion() == null
|| (producerExchange.getRegionDestination() != null && producerExchange.getRegionDestination().isDisposed())) {
// ensure the destination is registered with the RegionBroker
producerExchange.getConnectionContext().getBroker()
.addDestination(producerExchange.getConnectionContext(), destination, isAllowTempAutoCreationOnSend());
producerExchange.setRegion(getRegion(destination));
producerExchange.setRegionDestination(null);
}
producerExchange.getRegion().send(producerExchange, message);
// clean up so these references aren't kept (possible leak) in the producer exchange
// especially since temps are transitory
if (producerExchange.isMutable()) {
producerExchange.setRegionDestination(null);
producerExchange.setRegion(null);
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
Destination result = next.addDestination(context, destination,createIfTemporary);
Broker brokers[] = getListeners();
for (int i = 0; i < brokers.length; i++) {
brokers[i].addDestination(context, destination,createIfTemporary);
}
return result;
}
代码示例来源:origin: org.apache.activemq/activemq-broker
@Override
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
Destination result = next.addDestination(context, destination,createIfTemporary);
Broker brokers[] = getListeners();
for (int i = 0; i < brokers.length; i++) {
brokers[i].addDestination(context, destination,createIfTemporary);
}
return result;
}
代码示例来源:origin: org.apache.activemq/activemq-broker
@Override
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean createIfTemporary) throws Exception {
return getNext().addDestination(context, destination,createIfTemporary);
}
代码示例来源:origin: org.apache.activemq/activemq-broker
/**
* Looks up and lazily creates if necessary the destination for the given
* JMS name
*/
public Destination getDestination(ActiveMQDestination destination) throws Exception {
return getBroker().addDestination(getAdminConnectionContext(), destination,false);
}
代码示例来源:origin: org.apache.activemq/activemq-broker
@Override
public void create(Broker broker, ConnectionContext context, ActiveMQDestination destination) throws Exception {
if (destination.isQueue() && destination.isPattern()) {
DestinationFilter filter = DestinationFilter.parseFilter(new ActiveMQQueue(prefix + DestinationFilter.ANY_DESCENDENT));
if (filter.matches(destination)) {
broker.addDestination(context, destination, false);
}
}
}
代码示例来源:origin: org.apache.activemq/activemq-broker
@Override
public void addTopic(String name) throws Exception {
safeGetBroker().getContextBroker()
.addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQTopic(name), true);
}
代码示例来源:origin: org.apache.activemq/activemq-broker
@Override
public void addQueue(String name) throws Exception {
safeGetBroker().getContextBroker()
.addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQQueue(name), true);
}
内容来源于网络,如有侵权,请联系作者删除!