Informat
Informat

Reputation: 858

Tibco EMS - Listening to EMS Exception "Not allowed to create destination"

I am trying to listen to an EMS server as follows:

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'

I know that the EMS has been configured to disable queue and topic creation. However I'm only trying to listen to the topic. I've tried "CreateConsumer" as well. 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.

Upvotes: 0

Views: 2368

Answers (2)

Axel Podehl
Axel Podehl

Reputation: 4323

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)

TOPIC=foo USER=user1 PERM=subscribe

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:

>

Upvotes: 0

Brian Yule
Brian Yule

Reputation: 49

        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);
            };
        }

Upvotes: 1

Related Questions