org.bdware.doip.event.NaiveBroker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of doip-audit-tool Show documentation
Show all versions of doip-audit-tool Show documentation
doip audit tool developed by bdware
The newest version!
package org.bdware.doip.event;
import org.bdware.doip.RocksDBUtil;
import org.bdware.doip.audit.AuditDoaClient;
import org.bdware.doip.codec.doipMessage.DoipMessage;
import org.bdware.doip.endpoint.event.EventMessageParser;
import org.bdware.doip.endpoint.event.TopicHandler;
public class NaiveBroker implements TopicHandler {
EventMessageParser messageParser;
public NaiveBroker(String path, AuditDoaClient client, String myTopic) {
RocksDBUtil storageManager = RocksDBUtil.loadDB(path, false);
NaivePublisher publisher = new NaivePublisher(storageManager, client);
NaiveSubscriber subscriber = new NaiveSubscriber() {
@Override
public void onReceiveData(String topicId, String publisherId, DoipMessage request) {
//replace Topic
publisher.publish(myTopic, request);
}
};
messageParser = new EventMessageParser(publisher, subscriber);
}
@Override
public DoipMessage handlePublish(DoipMessage request) {
return messageParser.handlePublish(request);
}
@Override
public DoipMessage handleSubscribe(DoipMessage request) {
return messageParser.handleSubscribe(request);
}
}