private SynapseEventSource buildEventSource(EventSourceDTO eventSourceDTO) {
SynapseEventSource synapseEventSource = new SynapseEventSource(eventSourceDTO.getName());
SubscriptionManager subscriptionManager;
try {
if (eventSourceDTO.getType().equals("DefaultInMemory")) {
subscriptionManager = new DefaultInMemorySubscriptionManager();
}else if (eventSourceDTO.getType().equals("EmbRegistry")) {
subscriptionManager = (SubscriptionManager) Class.forName(
"org.wso2.carbon.eventing.impl.EmbeddedRegistryBasedSubscriptionManager")
.newInstance();
subscriptionManager.init();