All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.netgrid.got.edc.inject.modules.TopicModule Maven / Gradle / Ivy

There is a newer version: 0.0.4
Show newest version
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