简体   繁体   English

Tibco JMS(EMS)每个客户的TimeToLive?

[英]Tibco JMS (EMS) TimeToLive per client?

I haven't been able to figure this one out from Google alone. 我还无法单独从Google弄清楚这一点。 I am connecting to a non-durable EMS topic, which publishes updates to a set of data. 我正在连接一个非耐用的EMS主题,该主题发布对一组数据的更新。 If I skip a few updates, it doesn't matter, as the following update will overwrite it anyway. 如果我跳过一些更新,则没关系,因为以下更新仍会覆盖它。

The number of messages being published on the EMS topic is quite high, and occasionally for whatever reason the consumer lags behind. 在EMS主题上发布的消息数量很多,偶尔由于某种原因消费者会落后。 Is there a way, on the client connection side, to determine a 'time to live' for messages? 在客户端连接端,是否可以确定消息的“生存时间”? I know there is on other brokers, but specifically on Tibco I have been unable to figure out whether it's possible or not, only that this parameter can definitely be set on the server side for all clients (this is not an option for me). 我知道其他经纪人也有,但是特别是在Tibco上,我一直无法弄清楚是否可行,只是我可以肯定在所有客户端的服务器端都设置了此参数(这对我来说不是一个选择)。

I am creating my connection factory and then creating an Apache Camel jms endpoint with the following code: 我正在创建连接工厂,然后使用以下代码创建Apache Camel jms端点:

    TibjmsConnectionFactory connectionFactory = new TibjmsConnectionFactory();
    connectionFactory.setServerUrl(properties.getProperty(endpoints.getServerUrl()));
    connectionFactory.setUserName(properties.getProperty(endpoints.getUsername()));
    connectionFactory.setUserPassword(properties.getProperty(endpoints.getPassword()));

    JmsComponent emsComponent = JmsComponent.jmsComponent(connectionFactory);
    emsComponent.setAsyncConsumer(true);
    emsComponent.setConcurrentConsumers(Integer.parseInt(properties.getProperty("jms.concurrent.consumers")));
    emsComponent.setDeliveryPersistent(false);
    emsComponent.setClientId("MyClient." + ManagementFactory.getRuntimeMXBean().getName() + "." + emsConnectionNumber.getAndIncrement());
    return emsComponent;

I am using tibjms-6.0.1, tibjmsufo-6.0.1, and various other tib***-6.0.1. 我正在使用tibjms-6.0.1,tibjmsufo-6.0.1和其他tib ***-6.0.1。

The JMSExpiration property can be set per message or, more globally, at the destination level (in which case the JMSExpiration of all messages received in this destination is overridden). 可以为每条消息设置JMSExpiration属性,或者可以在目标级别 (更广泛地在全局级别)设置JMSExpiration属性(在这种情况下,将覆盖在此目标中接收的所有消息的JMSExpiration)。 It cannot be set per consumer. 不能为每个消费者设置。

One option would be to create a bridge from the topic to a custom queue that only your consumer application will listen to, and set the "expiration" property of this queue to 0 (unlimited). 一种选择是创建从主题到仅用户应用程序将收听的自定义队列的桥梁,并将此队列的“ expiration”属性设置为0(无限制)。 All messages published on the topic will then be copied to this queue and won't ever expire, whatever their JMSExpiration value. 然后,无论其JMSExpiration值如何,所有在该主题上发布的所有消息都将被复制到此队列,并且永远不会过期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM