-1

I am have created the camel route which use camel-paho component to consume MQTT stream. It is enabled with SSL and i need to pass the socket-factory. I went through the documentation od camel-paho and below parameter is available

  socketFactory (security)

Sets the SocketFactory to use. This allows an application to apply its own policies around the creation of network sockets. If using an SSL connection, an SSLSocketFactory can be used to supply application-specific security settings.

I have passed the custom socket-factory in the URL by setting the above parameter to the class name as below

from("paho:"test?brokerUrl="+MQTT_BROKER_URL+"&clientId=subX4&cleanSession=false&socketFactory=com.sample.mqttCustomSocketFactory.java")

Above setting is not working. Is that the correct way of passing the parameter ?

Girish Bhat M
  • 392
  • 3
  • 13

1 Answers1

1

Whenever you set a complex object to the Camel endpoint parameter, it needs to be a bean reference. So in your case, the endpoint should look something like this:

from("paho:test?...&socketFactory=#mySocketFactory")

where the #mySocketFactory is defined in the Camel bean registry like this:

SocketFactory mySocketFactory = ...
context.getRegistry().bind("mySocketFactory", mySocketFactory);

or in Spring context XML:

<bean id="mySocketFactory" ...>
Tadayoshi Sato
  • 1,401
  • 11
  • 18