Tabnine Logo
ActiveMQPrefetchPolicy
Code IndexAdd Tabnine to your IDE (free)

How to use
ActiveMQPrefetchPolicy
in
org.apache.activemq

Best Java code snippets using org.apache.activemq.ActiveMQPrefetchPolicy (Showing top 20 results out of 315)

origin: apache/activemq

/**
 * Sets the prefeftch policy to one.
 */
protected void setPrefetchToOne() {
  ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy();
  prefetchPolicy.setQueuePrefetch(1);
  prefetchPolicy.setTopicPrefetch(1);
  prefetchPolicy.setDurableTopicPrefetch(1);
  prefetchPolicy.setOptimizeDurableTopicPrefetch(1);
}
origin: apache/activemq

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);
origin: apache/activemq

/**
 * @param queuePrefetch
 *            The queuePrefetch to set.
 */
public void setQueuePrefetch(int queuePrefetch) {
  this.queuePrefetch = getMaxPrefetchLimit(queuePrefetch);
}
origin: apache/activemq

/**
 * @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();
    }
  };
}
origin: apache/activemq

/**
 * 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);
}
origin: apache/activemq

int prefetch = 0;
if (destination instanceof Topic) {
  prefetch = prefetchPolicy.getTopicPrefetch();
} else {
  prefetch = prefetchPolicy.getQueuePrefetch();
    prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
origin: apache/activemq

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;
}
origin: apache/activemq

.getTopicPrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, asyncDispatch);
origin: org.apache.james/james-server-queue-activemq

private ActiveMQPrefetchPolicy createActiveMQPrefetchPolicy() {
  ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
  prefetchPolicy.setQueuePrefetch(0);
  prefetchPolicy.setTopicPrefetch(0);
  return prefetchPolicy;
}
origin: com.github.combinedmq/combinedmq

@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);
}
origin: gocd/gocd

@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();
}
origin: org.apache.activemq/activemq-client

int prefetch = 0;
if (destination instanceof Topic) {
  prefetch = prefetchPolicy.getTopicPrefetch();
} else {
  prefetch = prefetchPolicy.getQueuePrefetch();
    prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
origin: org.apache.activemq/activemq-client

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;
}
origin: org.apache.activemq/activemq-client

/**
 * @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();
    }
  };
}
origin: org.apache.activemq/activemq-client

/**
 * 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);
}
origin: org.apache.activemq/activemq-client

.getTopicPrefetch(), prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, asyncDispatch);
origin: org.apache.activemq/activemq-all

int prefetch = 0;
if (destination instanceof Topic) {
  prefetch = prefetchPolicy.getTopicPrefetch();
} else {
  prefetch = prefetchPolicy.getQueuePrefetch();
    prefetch, prefetchPolicy.getMaximumPendingMessageLimit(), noLocal, false, isAsyncDispatch(), messageListener);
origin: pierre/meteo

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);
origin: apache/activemq

/**
 * @param queueBrowserPrefetch
 *            The queueBrowserPrefetch to set.
 */
public void setQueueBrowserPrefetch(int queueBrowserPrefetch) {
  this.queueBrowserPrefetch = getMaxPrefetchLimit(queueBrowserPrefetch);
}
origin: pierre/meteo

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;
}
org.apache.activemqActiveMQPrefetchPolicy

Javadoc

Defines the prefetch message policies for different types of consumers

Most used methods

  • <init>
    Initialize default prefetch policies
  • setQueuePrefetch
  • getDurableTopicPrefetch
  • getMaxPrefetchLimit
  • getMaximumPendingMessageLimit
  • getOptimizeDurableTopicPrefetch
  • getQueueBrowserPrefetch
  • getQueuePrefetch
  • getTopicPrefetch
  • setTopicPrefetch
  • setDurableTopicPrefetch
  • setOptimizeDurableTopicPrefetch
  • setDurableTopicPrefetch,
  • setOptimizeDurableTopicPrefetch,
  • getInputStreamPrefetch,
  • setAll

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Menu (java.awt)
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • ImageIO (javax.imageio)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now