/** * Sets the prefeftch policy to one. */ protected void setPrefetchToOne() { ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy(); prefetchPolicy.setQueuePrefetch(1); prefetchPolicy.setTopicPrefetch(1); prefetchPolicy.setDurableTopicPrefetch(1); prefetchPolicy.setOptimizeDurableTopicPrefetch(1); }
int prefetch = isAutoAcknowledge() && connection.isOptimizedMessageDispatch() ? prefetchPolicy.getOptimizeDurableTopicPrefetch() : prefetchPolicy.getDurableTopicPrefetch(); int maxPrendingLimit = prefetchPolicy.getMaximumPendingMessageLimit(); return new ActiveMQTopicSubscriber(this, getNextConsumerId(), ActiveMQMessageTransformation.transformDestination(topic), name, messageSelector, prefetch, maxPrendingLimit, noLocal, false, asyncDispatch);
/** * @param queuePrefetch * The queuePrefetch to set. */ public void setQueuePrefetch(int queuePrefetch) { this.queuePrefetch = getMaxPrefetchLimit(queuePrefetch); }
/** * @throws JMSException */ private ActiveMQMessageConsumer createConsumer() throws JMSException { browseDone.set(false); ActiveMQPrefetchPolicy prefetchPolicy = session.connection.getPrefetchPolicy(); return new ActiveMQMessageConsumer(session, consumerId, destination, null, selector, prefetchPolicy.getQueueBrowserPrefetch(), prefetchPolicy .getMaximumPendingMessageLimit(), false, true, dispatchAsync, null) { public void dispatch(MessageDispatch md) { if (md.getMessage() == null) { browseDone.set(true); } else { super.dispatch(md); } notifyMessageAvailable(); } }; }
/** * Creates a <CODE>QueueReceiver</CODE> object to receive messages from * the specified queue using a message selector. * * @param queue the <CODE>Queue</CODE> to access * @param messageSelector only messages with properties matching the message * selector expression are delivered. A value of null or an * empty string indicates that there is no message selector * for the message consumer. * @return QueueReceiver * @throws JMSException if the session fails to create a receiver due to * some internal error. * @throws InvalidDestinationException if an invalid queue is specified. * @throws InvalidSelectorException if the message selector is invalid. */ @Override public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException { checkClosed(); if (queue instanceof CustomDestination) { CustomDestination customDestination = (CustomDestination)queue; return customDestination.createReceiver(this, messageSelector); } ActiveMQPrefetchPolicy prefetchPolicy = this.connection.getPrefetchPolicy(); return new ActiveMQQueueReceiver(this, getNextConsumerId(), ActiveMQMessageTransformation.transformDestination(queue), messageSelector, prefetchPolicy.getQueuePrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), asyncDispatch); }
int prefetch = 0; if (destination instanceof Topic) { prefetch = prefetchPolicy.getTopicPrefetch(); } else { prefetch = prefetchPolicy.getQueuePrefetch(); prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
public boolean buildFromMap(Map<String, Object> properties) { boolean rc = false; ActiveMQPrefetchPolicy p = new ActiveMQPrefetchPolicy(); if (IntrospectionSupport.setProperties(p, properties, "prefetchPolicy.")) { setPrefetchPolicy(p); rc = true; } RedeliveryPolicy rp = new RedeliveryPolicy(); if (IntrospectionSupport.setProperties(rp, properties, "redeliveryPolicy.")) { setRedeliveryPolicy(rp); rc = true; } BlobTransferPolicy blobTransferPolicy = new BlobTransferPolicy(); if (IntrospectionSupport.setProperties(blobTransferPolicy, properties, "blobTransferPolicy.")) { setBlobTransferPolicy(blobTransferPolicy); rc = true; } rc |= IntrospectionSupport.setProperties(this, properties); return rc; }
.getTopicPrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, asyncDispatch);
private ActiveMQPrefetchPolicy createActiveMQPrefetchPolicy() { ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy(); prefetchPolicy.setQueuePrefetch(0); prefetchPolicy.setTopicPrefetch(0); return prefetchPolicy; }
@Override protected void init() { cfg = (ActiveMqConfiguration) getConfiguration(); if (null == cf) { cf = new ActiveMQConnectionFactory(); } Object value; if ((value = cfg.getBrokerUrl()) != null) cf.setBrokerURL(String.valueOf(value)); if ((value = cfg.getUsername()) != null) cf.setUserName(String.valueOf(value)); if ((value = cfg.getPassword()) != null) cf.setPassword(String.valueOf(value)); ActiveMQPrefetchPolicy policy = new ActiveMQPrefetchPolicy(); policy.setQueuePrefetch(1); cf.setPrefetchPolicy(policy); }
@Autowired public ActiveMqMessagingService(DaemonThreadStatsCollector daemonThreadStatsCollector) throws Exception { this.daemonThreadStatsCollector = daemonThreadStatsCollector; SystemEnvironment systemEnvironment = new SystemEnvironment(); broker = new BrokerService(); broker.setBrokerName(BROKER_NAME); broker.setPersistent(false); broker.setUseJmx(systemEnvironment.getActivemqUseJmx()); broker.getManagementContext().setConnectorPort(systemEnvironment.getActivemqConnectorPort()); broker.start(); factory = new ActiveMQConnectionFactory(BROKER_URL); factory.getPrefetchPolicy().setQueuePrefetch(systemEnvironment.getActivemqQueuePrefetch()); factory.setCopyMessageOnSend(false); connection = (ActiveMQConnection) factory.createConnection(); connection.start(); }
int prefetch = 0; if (destination instanceof Topic) { prefetch = prefetchPolicy.getTopicPrefetch(); } else { prefetch = prefetchPolicy.getQueuePrefetch(); prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
public boolean buildFromMap(Map<String, Object> properties) { boolean rc = false; ActiveMQPrefetchPolicy p = new ActiveMQPrefetchPolicy(); if (IntrospectionSupport.setProperties(p, properties, "prefetchPolicy.")) { setPrefetchPolicy(p); rc = true; } RedeliveryPolicy rp = new RedeliveryPolicy(); if (IntrospectionSupport.setProperties(rp, properties, "redeliveryPolicy.")) { setRedeliveryPolicy(rp); rc = true; } BlobTransferPolicy blobTransferPolicy = new BlobTransferPolicy(); if (IntrospectionSupport.setProperties(blobTransferPolicy, properties, "blobTransferPolicy.")) { setBlobTransferPolicy(blobTransferPolicy); rc = true; } rc |= IntrospectionSupport.setProperties(this, properties); return rc; }
/** * @throws JMSException */ private ActiveMQMessageConsumer createConsumer() throws JMSException { browseDone.set(false); ActiveMQPrefetchPolicy prefetchPolicy = session.connection.getPrefetchPolicy(); return new ActiveMQMessageConsumer(session, consumerId, destination, null, selector, prefetchPolicy.getQueueBrowserPrefetch(), prefetchPolicy .getMaximumPendingMessageLimit(), false, true, dispatchAsync, null) { public void dispatch(MessageDispatch md) { if (md.getMessage() == null) { browseDone.set(true); } else { super.dispatch(md); } notifyMessageAvailable(); } }; }
/** * Creates a <CODE>QueueReceiver</CODE> object to receive messages from * the specified queue using a message selector. * * @param queue the <CODE>Queue</CODE> to access * @param messageSelector only messages with properties matching the message * selector expression are delivered. A value of null or an * empty string indicates that there is no message selector * for the message consumer. * @return QueueReceiver * @throws JMSException if the session fails to create a receiver due to * some internal error. * @throws InvalidDestinationException if an invalid queue is specified. * @throws InvalidSelectorException if the message selector is invalid. */ @Override public QueueReceiver createReceiver(Queue queue, String messageSelector) throws JMSException { checkClosed(); if (queue instanceof CustomDestination) { CustomDestination customDestination = (CustomDestination)queue; return customDestination.createReceiver(this, messageSelector); } ActiveMQPrefetchPolicy prefetchPolicy = this.connection.getPrefetchPolicy(); return new ActiveMQQueueReceiver(this, getNextConsumerId(), ActiveMQMessageTransformation.transformDestination(queue), messageSelector, prefetchPolicy.getQueuePrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), asyncDispatch); }
.getTopicPrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, asyncDispatch);
int prefetch = 0; if (destination instanceof Topic) { prefetch = prefetchPolicy.getTopicPrefetch(); } else { prefetch = prefetchPolicy.getQueuePrefetch(); prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
int prefetch = isAutoAcknowledge() && connection.isOptimizedMessageDispatch() ? prefetchPolicy.getOptimizeDurableTopicPrefetch() : prefetchPolicy.getDurableTopicPrefetch(); int maxPrendingLimit = prefetchPolicy.getMaximumPendingMessageLimit(); return new ActiveMQTopicSubscriber(this, getNextConsumerId(), ActiveMQMessageTransformation.transformDestination(topic), name, messageSelector, prefetch, maxPrendingLimit, noLocal, false, asyncDispatch);
/** * @param queueBrowserPrefetch * The queueBrowserPrefetch to set. */ public void setQueueBrowserPrefetch(int queueBrowserPrefetch) { this.queueBrowserPrefetch = getMaxPrefetchLimit(queueBrowserPrefetch); }
public boolean buildFromMap(Map<String, Object> properties) { boolean rc = false; ActiveMQPrefetchPolicy p = new ActiveMQPrefetchPolicy(); if (IntrospectionSupport.setProperties(p, properties, "prefetchPolicy.")) { setPrefetchPolicy(p); rc = true; } RedeliveryPolicy rp = new RedeliveryPolicy(); if (IntrospectionSupport.setProperties(rp, properties, "redeliveryPolicy.")) { setRedeliveryPolicy(rp); rc = true; } BlobTransferPolicy blobTransferPolicy = new BlobTransferPolicy(); if (IntrospectionSupport.setProperties(blobTransferPolicy, properties, "blobTransferPolicy.")) { setBlobTransferPolicy(blobTransferPolicy); rc = true; } rc |= IntrospectionSupport.setProperties(this, properties); return rc; }