You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2019/10/10 11:38:00 UTC

[jira] [Comment Edited] (CAMEL-14052) camel-paho - Make it possible to configure userName, password from application.properties

    [ https://issues.apache.org/jira/browse/CAMEL-14052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16948477#comment-16948477 ] 

Claus Ibsen edited comment on CAMEL-14052 at 10/10/19 11:37 AM:
----------------------------------------------------------------

As workaround you can do
{code}
    @Bean
    public MqttConnectOptions myMqttConnectOptions(@Value("myUsername") String user, @Value("myPassword") String pw) {
        MqttConnectOptions mq = new MqttConnectOptions();
        mq.setUserName(user);
        mq.setPassword(pw.toCharArray());
        return mq;
    }
{code}

in the spring boot application class etc and in application.properties you can have the configuration

camel.component.paho.connect-options=#myMqttConnectOptions
myUsername=myuser
myPassword=mysecret



was (Author: davsclaus):
As workaround you can do
{code}
    @Bean
    public MqttConnectOptions myMqttConnectOptions(@Value("myUsername") String user, @Value("myPassword") String pw) {
        MqttConnectOptions mq = new MqttConnectOptions();
        mq.setUserName(user);
        mq.setPassword(pw.toCharArray());
        return mq;
    }
{code}

in the spring boot application class etc and in application.properties you can have the configuration

myUsername=myuser
myPassword=mysecret


> camel-paho - Make it possible to configure userName, password from application.properties
> -----------------------------------------------------------------------------------------
>
>                 Key: CAMEL-14052
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14052
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-paho
>    Affects Versions: 3.0.0.RC2
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 3.0.0
>
>
> When using spring boot then the connectorOptions is null, so when you do
> camel.component.paho.brokerUrl=tcp://localhost:61617
> camel.component.paho.connectOptions.userName=admin
> camel.component.paho.connectOptions.password=admin123.
> It will fail



--
This message was sent by Atlassian Jira
(v8.3.4#803005)