public void deactivate(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); if (processor instanceof ScheduledMessageForwardingProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (view.isActive()) { view.deactivate(); getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } else { log.warn("Scheduled Message Forwarding Processor - already deActive"); } } else if (processor instanceof SamplingProcessor) { SamplingProcessorView view = ((SamplingProcessor) processor).getView(); if (view.isActive()) { view.deactivate(); getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } else { log.warn("Sampling Message Processor - already in the deactivated state"); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } }
/** * Get the Number of Messages in the message store associated with the processor * * @param processorName * @return */ public int getSize(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); int size = 0; try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); if (processor instanceof ScheduledMessageProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (!view.isActive()) { size = view.getSize(); } else { log.warn("Can't access Scheduled Message Forwarding Processor - Processor is active"); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } return size; }
/** * Get the Active Status of the message processor * * @param processorName * @return */ public boolean isActive(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); boolean active = false; try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); if (processor instanceof ScheduledMessageForwardingProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (view != null) { active = view.isActive(); } } else if (processor instanceof SamplingProcessor) { SamplingProcessorView view = ((SamplingProcessor) processor).getView(); if (view != null) { active = view.isActive(); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } return active; }
/** * Get All the Messages Stored in the Message Store associated with the Processor * * @param processorName ScheduledMessageForwarding Processor Name * @return Array of Message ids. * @throws AxisFault */ public String[] getMessageIds(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); String[] messageIds = null; try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); if (processor instanceof ScheduledMessageProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (!view.isActive()) { List<String> msgList = view.messageIdList(); messageIds = msgList.toArray(new String[msgList.size()]); } else { log.warn("Can't access Scheduled Message Forwarding Processor - Processor is active"); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } return messageIds; }