user3297833
user3297833

Reputation: 171

What are the attributes needed to read a Tibco EMS message queue from C#

I'm getting the following exception thrown when executing the AfterPropertiesSet():

Not allowed to create destination

From Java guys I was given these:

pt-jndi-url: tibjmsnaming://tibjndi-pt.mycompany.com:12420

pt-project1-username: ticketsappsgreeks-ext

pt-project1-password: tickets41040

queue name: ALS.QA.tickets.TEST.QUEUE_CONNECTION

pt-project1-jndi-queue-connection-factory-name: ALS.PT.tickets.greeks.QCF.MS

I translated these into the following in the C# calls:

Uri : tibjndi-pt.mycompany.com:12420

User : ticketsappsgreeks-ext

Pwd : tickets41040

TargetHostName : tibjndi-pt.mycompany.com

Destination : ALS.QA.tickets.TEST.QUEUE_CONNECTION

Environment:

C# Code:

private readonly SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer();
                
                connectionFactory = new Spring.Messaging.Ems.Common.EmsConnectionFactory(Uri);
                if (!string.IsNullOrEmpty(User))
                {
                    connectionFactory.UserName = User;
                    Logger.Info($"User : {User}");
                }

                if (!string.IsNullOrEmpty(Pwd))
                {
                    connectionFactory.UserPassword = Pwd;
                    Logger.Info($"Pwd : {Pwd}");
                }

                if (!string.IsNullOrEmpty(TargetHostName))
                {
                    connectionFactory.TargetHostName = TargetHostName;
                    Logger.Info($"TargetHostName : {TargetHostName}");
                }
                
                connectionFactory.ClientID = "testClient1";
                
                try
                {
                    Logger.Debug($"Destination - {DestinationName}");

                    this.listenerContainer.ConnectionFactory = connectionFactory;
                    this.listenerContainer.DestinationName = DestinationName;
                    this.listenerContainer.ConcurrentConsumers = 1;
                    this.listenerContainer.PubSubDomain = false;
                    this.listenerContainer.MessageListener = new MessageListener(Logger);
                    this.listenerContainer.ExceptionListener = new ExceptionListener(Logger);
                    this.listenerContainer.MaxRecoveryTime = new TimeSpan(MaxRecoveryTimeInDays, 0, 0, 0);
                    this.listenerContainer.RecoveryInterval = new TimeSpan(0, 0, 0, 10, 0); // set to 10 Minutes  
                    this.listenerContainer.AcceptMessagesWhileStopping = false;
                    this.listenerContainer.SessionAcknowledgeMode = AckMode;
                    this.listenerContainer.AfterPropertiesSet();
                    if (this.listenerContainer.IsRunning)
                    {
                        Logger.Debug("Listener IsRunning.");
                    }

                }
                catch (EMSException e)
                {
                    Logger.Error($"EMSException : {e.Message}");

                    if (e.LinkedException != null)
                    {
                        Logger.Error($"EMSException Linked Exception error msg : {e.LinkedException.Message}");
                    }
                }

Upvotes: 1

Views: 610

Answers (1)

user3297833
user3297833

Reputation: 171

If you found your way here then you probably wasted the same amount of time that I did researching how to read a Tibco EMS queue.

Do not use the SpringFamework for .Net since it's dead. Instead go back and download the Tibco community edition and start with the samples provided by the vendor.

Found this: Is Spring.NET project dead?

Upvotes: 0

Related Questions