
it.netgrid.got.edc.inject.modules.TopicModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edc-connector Show documentation
Show all versions of edc-connector Show documentation
Bauer's stand-alone connector to the Everywhare Cloud
package it.netgrid.got.edc.inject.modules;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import it.nergrid.got.edc.ECTopic;
import it.nergrid.got.edc.TopicThread;
import it.netgrid.bauer.Topic;
import it.netgrid.bauer.TopicFactory;
import it.netgrid.got.edc.events.MessageFromBauer;
import it.netgrid.got.edc.events.MessageToBauer;
import it.netgrid.got.edc.properties.EdcPropertiesConfiguration;
import it.netgrid.got.edc.events.ErrorEvent;
public class TopicModule extends AbstractModule {
private String topic;
private String sendTopic;
private String receiveTopic;
public TopicModule(String topic, String sendTopic, String receiveTopic) {
this.topic = topic;
this.sendTopic = sendTopic;
this.receiveTopic = receiveTopic;
}
@Override
protected void configure() {
}
@Provides
public String getTopic() {
return topic;
}
@Provides
public TopicThread buildThread(String topic, ECTopic ecTopic, Topic sendTopic,
Topic receiveTopic, Topic errorTopic) {
return new TopicThread(topic, sendTopic, receiveTopic, errorTopic, ecTopic);
}
@Provides
public Topic getSendTopic() {
return TopicFactory.getTopic(sendTopic);
}
@Provides
public Topic getReceiveTopic() {
return TopicFactory.getTopic(receiveTopic);
}
@Singleton
@Provides
public Topic getErrorTopic(EdcPropertiesConfiguration conf) {
return TopicFactory.getTopic(conf.getTopicError());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy