public PolicyEntry getEntryFor(ActiveMQDestination destination) { PolicyEntry answer = (PolicyEntry) chooseValue(destination); if (answer == null) { answer = getDefaultEntry(); } return answer; }
protected void configureTopic(Topic topic, ActiveMQDestination destination) { if (broker == null) { throw new IllegalStateException("broker property is not set"); } if (broker.getDestinationPolicy() != null) { PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker,topic); } } }
private PolicyEntry getDefaultPolicyEntry() { PolicyMap destinationPolicy = brokerService.getDestinationPolicy(); if (null == destinationPolicy) { destinationPolicy = new PolicyMap(); brokerService.setDestinationPolicy(destinationPolicy); } PolicyEntry defaultEntry = destinationPolicy.getDefaultEntry(); if (null == defaultEntry) { defaultEntry = new PolicyEntry(); destinationPolicy.setDefaultEntry(defaultEntry); } return defaultEntry; }
BrokerService bs = new BrokerService(); bs.addConnector("tcp://localhost:61616"); PolicyMap pm = new PolicyMap(); PolicyEntry pe = new PolicyEntry(); pe.setPrioritizedMessages(true); pm.setDefaultEntry(pe); bs.setDestinationPolicy(pm); bs.start();
PolicyMap policyMap = broker.getDestinationPolicy(); PolicyEntry policy = new PolicyEntry(); policy.setSubscriptionRecoveryPolicy( new LastImageSubscriptionRecoveryPolicy() ); ActiveMQDestination destination = (ActiveMQDestination) session.createTopic( "a.topic" ); policyMap.put( destination, policy );
public void addNewPolicyEntry(PolicyEntry addition) { PolicyMap existingMap = getBrokerService().getDestinationPolicy(); existingMap.put(addition.getDestination(), addition); PolicyEntryUtil.applyRetrospectively(this, addition, null); info("added policy for: " + addition.getDestination()); }
protected void configureQueue(Queue queue, ActiveMQDestination destination) { if (broker == null) { throw new IllegalStateException("broker property is not set"); } if (broker.getDestinationPolicy() != null) { PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker,queue); } } }
public PolicyEntry getEntryFor(ActiveMQDestination destination) { PolicyEntry answer = (PolicyEntry) chooseValue(destination); if (answer == null) { answer = getDefaultEntry(); } return answer; }
@Override public void addNew(Object o) { PolicyEntry addition = fromDto(o, new PolicyEntry()); PolicyMap existingMap = plugin.getBrokerService().getDestinationPolicy(); existingMap.put(addition.getDestination(), addition); applyRetrospectively(addition); plugin.info("added policy for: " + addition.getDestination()); }
protected void configureTopic(Topic topic, ActiveMQDestination destination) { if (broker.getDestinationPolicy() != null) { PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker,topic); } } }
public PolicyEntry getEntryFor(ActiveMQDestination destination) { PolicyEntry answer = (PolicyEntry) chooseValue(destination); if (answer == null) { answer = getDefaultEntry(); } return answer; }
@Override public void processConsumerControl(ConsumerBrokerExchange consumerExchange, ConsumerControl control) { Subscription sub = subscriptions.get(control.getConsumerId()); if (sub != null && sub instanceof AbstractSubscription) { ((AbstractSubscription) sub).setPrefetchSize(control.getPrefetch()); if (broker.getDestinationPolicy() != null) { PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(control.getDestination()); if (entry != null) { entry.configurePrefetch(sub); } } LOG.debug("setting prefetch: {}, on subscription: {}; resulting value: {}", new Object[]{ control.getPrefetch(), control.getConsumerId(), sub.getConsumerInfo().getPrefetchSize()}); try { lookup(consumerExchange.getConnectionContext(), control.getDestination(),false).wakeup(); } catch (Exception e) { LOG.warn("failed to deliver post consumerControl dispatch-wakeup, to destination: {}", control.getDestination(), e); } } }
public PolicyEntry getEntryFor(ActiveMQDestination destination) { PolicyEntry answer = (PolicyEntry) chooseValue(destination); if (answer == null) { answer = getDefaultEntry(); } return answer; }
protected NetworkBridgeFilter createNetworkBridgeFilter(ConsumerInfo info) throws IOException { NetworkBridgeFilterFactory filterFactory = defaultFilterFactory; if (brokerService != null && brokerService.getDestinationPolicy() != null) { PolicyEntry entry = brokerService.getDestinationPolicy().getEntryFor(info.getDestination()); if (entry != null && entry.getNetworkBridgeFilterFactory() != null) { filterFactory = entry.getNetworkBridgeFilterFactory(); } } return filterFactory.create(info, getRemoteBrokerPath(), configuration.getMessageTTL(), configuration.getConsumerTTL()); }
public PolicyEntry getEntryFor(ActiveMQDestination destination) { PolicyEntry answer = (PolicyEntry) chooseValue(destination); if (answer == null) { answer = getDefaultEntry(); } return answer; }
protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws JMSException { if (info.isDurable()) { throw new JMSException("A durable subscription cannot be created for a temporary topic."); } try { TopicSubscription answer = new TopicSubscription(broker, context, info, usageManager); // lets configure the subscription depending on the destination ActiveMQDestination destination = info.getDestination(); if (destination != null && broker.getDestinationPolicy() != null) { PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker, usageManager, answer); } } answer.init(); return answer; } catch (Exception e) { LOG.error("Failed to create TopicSubscription ", e); JMSException jmsEx = new JMSException("Couldn't create TopicSubscription"); jmsEx.setLinkedException(e); throw jmsEx; } }
PolicyEntry entry = regionBroker.getDestinationPolicy().getEntryFor(dest); if (entry != null) { entry.configure(broker, usageManager, this);
protected Subscription createSubscription(ConnectionContext context, ConsumerInfo info) throws JMSException { ActiveMQDestination destination = info.getDestination(); PolicyEntry entry = null; if (destination != null && broker.getDestinationPolicy() != null) { entry = broker.getDestinationPolicy().getEntryFor(destination); } if (info.isBrowser()) { QueueBrowserSubscription sub = new QueueBrowserSubscription(broker,usageManager, context, info); if (entry != null) { entry.configure(broker, usageManager, sub); } return sub; } else { QueueSubscription sub = new QueueSubscription(broker, usageManager,context, info); if (entry != null) { entry.configure(broker, usageManager, sub); } return sub; } }
PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker, usageManager, sub); PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination); if (entry != null) { entry.configure(broker, usageManager, answer);