@Override
 public void saveStreamDefinitionToStore(StreamDefinition streamDefinition, int tenantId)
     throws StreamDefinitionStoreException {
   boolean tenantFlowStarted = false;
   try {
     tenantFlowStarted = startTenantFlow(tenantId);
     ServiceHolder.getEventStreamService().addEventStreamDefinition(streamDefinition);
   } catch (EventStreamConfigurationException ex) {
     String msg = "Error while saving the stream definition: " + streamDefinition;
     log.error(msg, ex);
     throw new StreamDefinitionStoreException(msg, ex);
   } finally {
     if (tenantFlowStarted) PrivilegedCarbonContext.endTenantFlow();
   }
 }
 @Override
 public StreamDefinition getStreamDefinitionFromStore(String streamId, int tenantId)
     throws StreamDefinitionStoreException {
   boolean tenantFlowStarted = false;
   try {
     tenantFlowStarted = startTenantFlow(tenantId);
     return ServiceHolder.getEventStreamService().getStreamDefinition(streamId);
   } catch (EventStreamConfigurationException ex) {
     String msg = "Error while loading the stream definition Id: " + streamId;
     log.error(msg + streamId, ex);
     throw new StreamDefinitionStoreException(msg, ex);
   } finally {
     if (tenantFlowStarted) PrivilegedCarbonContext.endTenantFlow();
   }
 }
 @Override
 public Collection<StreamDefinition> getAllStreamDefinitionsFromStore(int tenantId)
     throws StreamDefinitionStoreException {
   boolean tenantFlowStarted = false;
   try {
     tenantFlowStarted = startTenantFlow(tenantId);
     return ServiceHolder.getEventStreamService().getAllStreamDefinitions();
   } catch (EventStreamConfigurationException ex) {
     String msg = "Error while loading all stream definitions for tenant: " + tenantId;
     log.error(msg, ex);
     throw new StreamDefinitionStoreException(msg, ex);
   } finally {
     if (tenantFlowStarted) PrivilegedCarbonContext.endTenantFlow();
   }
 }
 @Override
 public boolean removeStreamDefinition(String name, String version, int tenantId) {
   boolean tenantFlowStarted = false;
   try {
     tenantFlowStarted = startTenantFlow(tenantId);
     ServiceHolder.getEventStreamService().removeEventStreamDefinition(name, version);
     return true;
   } catch (EventStreamConfigurationException ex) {
     String msg =
         "Error while removing the stream definition name :" + name + ", version : " + version;
     log.error(msg, ex);
     return false;
   } finally {
     if (tenantFlowStarted) PrivilegedCarbonContext.endTenantFlow();
   }
 }