简体   繁体   English

Tibco EMS-侦听EMS异常“不允许创建目的地”

[英]Tibco EMS - Listening to EMS Exception “Not allowed to create destination”

I am trying to listen to an EMS server as follows: 我正在尝试听EMS服务器,如下所示:

Topic clientTopic = _subscriberSession.CreateTopic(topicName);
TopicSubscriber clientTopicSubscriber = _subscriberSession.CreateSubscriber(clientTopic, selector, true);
clientTopicSubscriber.MessageHandler += new EMSMessageHandler(test_MessageHandler);

However, when i do this, an exception is thrown: 但是,当我这样做时,会引发异常:
TIBCO.EMS.InvalidDestinationException: 'Not allowed to create destination' TIBCO.EMS.InvalidDestinationException:'不允许创建目的地'

I know that the EMS has been configured to disable queue and topic creation. 我知道EMS已配置为禁用队列和主题创建。 However I'm only trying to listen to the topic. 但是,我只是想听听这个话题。 I've tried "CreateConsumer" as well. 我也尝试过“ CreateConsumer”。 I do not understand what is going wrong. 我不明白怎么了。 I am only trying to listen and not create a queue or topic. 我只是想听,而不是创建队列或主题。 Do you guys know whats wrong? 你们知道怎么了吗?

Additionally, the Topic i'm trying to listen to exists and has been verified. 此外,我正在尝试收听的主题已存在且已通过验证。

        var context = new LookupContext(environment);
        var factory = context.Lookup(config.ConnectionFactory) as ConnectionFactory;
        try
        {
            connectionCorp = factory.CreateConnection();
        }
        catch {
            var connectionFactory = new ConnectionFactory(factory.Url, "Receiver", environment);
            connectionCorp = connectionFactory.CreateConnection();
        }
        connectionCorp.Start();
        sessionCorp = connectionCorp.CreateSession(false, SessionMode.ClientAcknowledge);
        var queue = context.Lookup(config.Name) as Destination;
        if(queue is TIBCO.EMS.Topic)
        {
            var selector = string.Format("To='{0}' and From='{1}'", config.ToAddress, config.FromAddress);
            msgConsumer = sessionCorp.CreateConsumer(queue, selector,false);
            msgConsumer.MessageHandler += (sender, args) => {
                action(args);
            };
        }
        else
        {
            msgConsumer = sessionCorp.CreateConsumer(queue);
            msgConsumer.MessageHandler += (sender, args) => {
                action(args);
            };
        }

Even though you are only listening to a topic, by default, you need permissions to see any of the traffic. 即使您只在听一个主题,默认情况下,您也需要具有查看任何流量的权限。 Also just subscribing to a topic requires the 'subscribe' permission. 同样,仅订阅主题也需要“订阅”权限。

In your case you could add (replace foo with your actual client topic and user1 with your username) 在您的情况下,您可以添加(将foo替换为您的实际客户主题,并将user1替换为您的用户名)

TOPIC=foo USER=user1 PERM=subscribe 主题= foo用户=用户1 PERM =订阅

Or, if you don't want to bother with permissions just yet, simply add the '>' wildcard into a single line of topics.conf and queue.conf and restart tibemsd: 或者,如果您现在还不想打扰权限,只需将'>'通配符添加到topic.conf和queue.conf的一行中,然后重新启动tibemsd:

> >

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

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