cancel
Showing results for 
Search instead for 
Did you mean: 

Apache MQ 5.2 and PI 7.11: failover:// protocol support in PI JMS adapter

Former Member
0 Kudos

Hi,

Does anyone know if the failover:// protocol is supported by PI in JMS adapter when using transport protocol: Access JMS provider Generically?

Scenario: PI 7.11 JMS channel sending and receiving JMS messages with Apache MQ 5.2 JMS provider.

Following parameter is maintained as additional Parameter in sender JMS channel:

JMS.QueueConnectionFactoryImpl.classname = org.apache.activemq.ActiveMQConnectionFactory

JMS.QueueConnectionFactoryImpl.constructor = java.lang.String tcp://host:port

JMS.QueueImpl.classname=org.apache.activemq.command.ActiveMQQueue

JMS.QueueImpl.constructor=java.lang.String TEST.Q

The connection works fine in production.!!!

Now, problem starts when Apache MQ host started using custering. there is now two host both hosting same queues for cases like failover.

http://activemq.apache.org/clustering.html

As per apache configuration syntax (http://activemq.apache.org/failover-transport-reference.html) we tried to use following

JMS.QueueConnectionFactoryImpl.constructor = java.lang.String failover://(tcp://host A:port,tcp://host B:port)?randomize=true

or

JMS.QueueConnectionFactoryImpl.constructor = java.lang.String failover:(tcp://host A:port,tcp://host B:port)?randomize=true

but both following error:

Error creating JMS connection. The JMS provider gave the error message as Could not create Transport. Reason: java.io.IOException: Invalid location: failover://(tcp://host A:port Invalid location: failover://((tcp://host A:port, and the error code as null.

Have anyone used clustering with Apache MQ with PI 7.11? Does PI support JMS provider clustering for queues and topics?

Your answer is much appreciated.

Br

Suman

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Suman,

Please try to URL encode the comma ',' separator of the failover hosts with %2C.

JMS.QueueConnectionFactoryImpl.constructor = java.lang.String failover://(tcp://host A:port%2Ctcp://host B:port)?randomize=true

or

JMS.QueueConnectionFactoryImpl.constructor = java.lang.String failover:(tcp://host A:port%2Ctcp://host B:port)?randomize=true

The reason for this is that the JMS adapter uses ',' sign for delimiting multiple parameters in connection factory constructor or method, so your URI is truncated.

Best Regards,

Dimitar

Former Member
0 Kudos

Hi,

Thanks both of you. eventually replacing "," did the trick. I can send and read the messages from both the host using failover.

Regards

Suman

0 Kudos

Hi Suman,

I am glad that the workaround works for you!

Just for information it will not work for arbitrary parameter. In this case the trick is that the ActiveMQ library handles this String as URI and decodes %2C back to ','.

Best Regards,

Dimitar

Former Member
0 Kudos

Hi Dimitar,

I also get this from SAP support that this is not a feature in PI JMS adapter and they don't have codebase to support this kind of provider specific failover. Also Apache MQ is new to PI connectivity!! I guess we just got lucky in this case that this is at least connecting to Apache MQ using failover keyword. However I am still testing this connection with application systems (e-to-e). I already faced some strange things like if the queue is not instantiated in one of the failover host in FUSE (apache MQ); PI throws error saying, JMS user don't have authorization to create queues. Which is really strange as when we put a test message in the queue the error disappear!!!.

Anyway can you please share your experience with this type of connection or elaborate on cases where it doesn't work "for arbitrary parameter"?? would be helpfull for me or whoever face this type of challanges I guess.

Many thanks

Suman.

0 Kudos

Hi Suman,

JMS Adapter uses what is specified in the JMS spec to communicate with the providers. As the spec does not say anything about failover it is upto the provider to define how it is done. In this respect PI JMS Adapter could use any JMS provider, which is compiant with JMS spec.

If you are experiencing any strange behaviour and you can repoduce please set the severity of the log location com.sap.aii.adapter.jms to debug and attach the complete exception. It could be some behavior of queues with the ActiveMQ.

I do not have any specific experience with this provider, so I will be glad to know how this works for you.

Regarding the parameter question, what I mean is that if the parameter did not represent an URL but some other setting with ',' in the values, it would not work as nobody would decode it.

Best Regards,

Dimitar

Former Member
0 Kudos

Does anyone have this running with AEX 7.4 and ActiveMQ 5.9.1? I cannot get this working in our System.

When I use this connection string everything is working fine:

java.lang.String failover:tcp://server3.domain.net:61616

However when I add two other servers separated by %2C it is not working, the communication channel stays in status starting and I cannot see an active connection in ActiveMQ:

java.lang.String failover:tcp://server1.domain.net:61616%2Ctcp://server2.domain.net:61616%2Ctcp://server3.domain.net:61616

Any idea where the error is? I can see nothing in the logfiles of the AEX...

Best regards,

Markus

Former Member
0 Kudos

Hi,

we also try to do this this PI (AEX) 7.4 but we always get the error "hostname can*t be null and the error code as null"

We also see nothing at the log files.

Any Ideas ?

Regards

   Thorsten

martinkoch
Active Participant
0 Kudos

Hi,

please check SAP Note 1678742.

There you can find the information that you have to escape the , with a leading \

Br,

Martin

Answers (2)

Answers (2)

martinkoch
Active Participant
0 Kudos

I solved the problem with the XPI Inspector

and by applying the configuration mentioned in SAP note 1678742.

According to this note you have to escape the comma with a backslash.

Worked for me on PI AEX 7.40

Best regards,

Martin

Former Member
0 Kudos

Hello!

I don't think this is implemented in the JMS adapter.Usually, in case of failover, the constructor receives a string like:

java.lang.String tcp://host A:port, tcp://host B:port

Isn't possible to set the configuration like that?

BR,

Lucas