aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick/components/configuration/XMPPConfiguration.java
blob: 0073b502245bf75dc5bc733fe610960b14740cc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.juick.components.configuration;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import rocks.xmpp.core.session.Extension;
import rocks.xmpp.core.session.XmppSessionConfiguration;
import rocks.xmpp.core.session.debug.LogbackDebugger;
import rocks.xmpp.extensions.component.accept.ExternalComponent;

/**
 * Created by vital on 29.03.2017.
 */
@Configuration
public class XMPPConfiguration {
    @Value("${push_jid}")
    private String pushJid;
    @Value("${xmpp_host:localhost}")
    private String xmppHost;
    @Value("${xmpp_port:5347}")
    private int xmppPort;
    @Value("${push_xmpp_password:secret}")
    private String xmppPushPassword;

    @Bean
    public ExternalComponent xmpp() {
        XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
                .extensions(Extension.of(com.juick.Message.class))
                .debugger(LogbackDebugger.class)
                .build();
        return ExternalComponent.create(pushJid, xmppPushPassword, configuration, xmppHost, xmppPort);
    }
}