本文整理汇总了Java中org.apache.activemq.command.ActiveMQDestination.getOptions方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQDestination.getOptions方法的具体用法?Java ActiveMQDestination.getOptions怎么用?Java ActiveMQDestination.getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ActiveMQDestination
的用法示例。
在下文中一共展示了ActiveMQDestination.getOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ActiveMQOutputStream
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public ActiveMQOutputStream(ActiveMQConnection connection, ProducerId producerId, ActiveMQDestination destination, Map<String, Object> properties, int deliveryMode, int priority,
long timeToLive) throws JMSException {
this.connection = connection;
this.deliveryMode = deliveryMode;
this.priority = priority;
this.timeToLive = timeToLive;
this.properties = properties == null ? null : new HashMap<String, Object>(properties);
Integer chunkSize = this.properties == null ? null : (Integer) this.properties.get(AMQ_STREAM_CHUNK_SIZE);
if (chunkSize == null) {
chunkSize = 64 * 1024;
} else {
if (chunkSize < 1) {
throw new IllegalArgumentException("Chunk size must be greater then 0");
} else {
chunkSize *= 1024;
}
}
buffer = new byte[chunkSize];
if (destination == null) {
throw new InvalidDestinationException("Don't understand null destinations");
}
this.info = new ProducerInfo(producerId);
// Allows the options on the destination to configure the stream
if (destination.getOptions() != null) {
Map<String, String> options = new HashMap<String, String>(destination.getOptions());
IntrospectionSupport.setProperties(this, options, "producer.");
IntrospectionSupport.setProperties(this.info, options, "producer.");
if (options.size() > 0) {
String msg = "There are " + options.size()
+ " producer options that couldn't be set on the producer."
+ " Check the options are spelled correctly."
+ " Unknown parameters=[" + options + "]."
+ " This producer cannot be started.";
LOG.warn(msg);
throw new ConfigurationException(msg);
}
}
this.info.setDestination(destination);
this.connection.addOutputStream(this);
this.connection.asyncSendPacket(info);
}
示例2: ActiveMQInputStream
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
public ActiveMQInputStream(ActiveMQConnection connection, ConsumerId consumerId, ActiveMQDestination dest, String selector, boolean noLocal, String name, int prefetch, long timeout)
throws JMSException {
this.connection = connection;
if (dest == null) {
throw new InvalidDestinationException("Don't understand null destinations");
} else if (dest.isTemporary()) {
String physicalName = dest.getPhysicalName();
if (physicalName == null) {
throw new IllegalArgumentException("Physical name of Destination should be valid: " + dest);
}
String connectionID = connection.getConnectionInfo().getConnectionId().getValue();
if (physicalName.indexOf(connectionID) < 0) {
throw new InvalidDestinationException("Cannot use a Temporary destination from another Connection");
}
if (connection.isDeleted(dest)) {
throw new InvalidDestinationException("Cannot use a Temporary destination that has been deleted");
}
}
if (timeout < -1) throw new IllegalArgumentException("Timeout must be >= -1");
this.timeout = timeout;
this.info = new ConsumerInfo(consumerId);
this.info.setSubscriptionName(name);
if (selector != null && selector.trim().length() != 0) {
selector = "JMSType='org.apache.activemq.Stream' AND ( " + selector + " ) ";
} else {
selector = "JMSType='org.apache.activemq.Stream'";
}
SelectorParser.parse(selector);
this.info.setSelector(selector);
this.info.setPrefetchSize(prefetch);
this.info.setNoLocal(noLocal);
this.info.setBrowser(false);
this.info.setDispatchAsync(false);
// Allows the options on the destination to configure the consumerInfo
if (dest.getOptions() != null) {
Map<String, String> options = new HashMap<String, String>(dest.getOptions());
IntrospectionSupport.setProperties(this.info, options, "consumer.");
}
this.info.setDestination(dest);
this.connection.addInputStream(this);
this.connection.addDispatcher(info.getConsumerId(), this);
this.connection.syncSendPacket(info);
unconsumedMessages.start();
}
示例3: ActiveMQMessageProducer
import org.apache.activemq.command.ActiveMQDestination; //导入方法依赖的package包/类
protected ActiveMQMessageProducer(ActiveMQSession session, ProducerId producerId, ActiveMQDestination destination, int sendTimeout) throws JMSException {
super(session);
this.info = new ProducerInfo(producerId);
this.info.setWindowSize(session.connection.getProducerWindowSize());
// Allows the options on the destination to configure the producerInfo
if (destination != null && destination.getOptions() != null) {
Map<String, Object> options = IntrospectionSupport.extractProperties(
new HashMap<String, Object>(destination.getOptions()), "producer.");
IntrospectionSupport.setProperties(this.info, options);
if (options.size() > 0) {
String msg = "There are " + options.size()
+ " producer options that couldn't be set on the producer."
+ " Check the options are spelled correctly."
+ " Unknown parameters=[" + options + "]."
+ " This producer cannot be started.";
LOG.warn(msg);
throw new ConfigurationException(msg);
}
}
this.info.setDestination(destination);
// Enable producer window flow control if protocol > 3 and the window
// size > 0
if (session.connection.getProtocolVersion() >= 3 && this.info.getWindowSize() > 0) {
producerWindow = new MemoryUsage("Producer Window: " + producerId);
producerWindow.setExecutor(session.getConnectionExecutor());
producerWindow.setLimit(this.info.getWindowSize());
producerWindow.start();
}
this.defaultDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.defaultPriority = Message.DEFAULT_PRIORITY;
this.defaultTimeToLive = Message.DEFAULT_TIME_TO_LIVE;
this.startTime = System.currentTimeMillis();
this.messageSequence = new AtomicLong(0);
this.stats = new JMSProducerStatsImpl(session.getSessionStats(), destination);
try {
this.session.addProducer(this);
this.session.syncSendPacket(info);
} catch (JMSException e) {
this.session.removeProducer(this);
throw e;
}
this.setSendTimeout(sendTimeout);
setTransformer(session.getTransformer());
}