Search in sources :

Example 1 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class InboundEndpointDeployer method deploySynapseArtifact.

@Override
public String deploySynapseArtifact(OMElement artifactConfig, String fileName, Properties properties) {
    CustomLogSetter.getInstance().setLogAppender(customLogContent);
    if (log.isDebugEnabled()) {
        log.debug("InboundEndpoint deployment from file : " + fileName + " : Started");
    }
    try {
        InboundEndpoint inboundEndpoint = InboundEndpointFactory.createInboundEndpoint(artifactConfig, getSynapseConfiguration());
        if (inboundEndpoint != null) {
            inboundEndpoint.setArtifactContainerName(customLogContent);
            inboundEndpoint.setFileName(new File(fileName).getName());
            if (log.isDebugEnabled()) {
                log.debug("Inbound Endpoint named '" + inboundEndpoint.getName() + "' has been built from the file " + fileName);
            }
            inboundEndpoint.init(getSynapseEnvironment());
            if (log.isDebugEnabled()) {
                log.debug("Initialized the Inbound Endpoint: " + inboundEndpoint.getName());
            }
            getSynapseConfiguration().addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
            if (log.isDebugEnabled()) {
                log.debug("Inbound Endpoint deployment from file : " + fileName + " : Completed");
            }
            log.info("Inbound Endpoint named '" + inboundEndpoint.getName() + "' has been deployed from file : " + fileName);
            return inboundEndpoint.getName();
        }
    } catch (Exception e) {
        handleSynapseArtifactDeploymentError("Inbound Endpoint deployment from the file : " + fileName + " : Failed.", e);
    }
    return null;
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) File(java.io.File) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 2 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class InboundEndpointDeployer method restoreSynapseArtifact.

@Override
public void restoreSynapseArtifact(String artifactName) {
    if (log.isDebugEnabled()) {
        log.debug("Restoring the Inbound Endpoint with name : " + artifactName + " : Started");
    }
    try {
        InboundEndpoint inboundEndpoint = getSynapseConfiguration().getInboundEndpoint(artifactName);
        CustomLogSetter.getInstance().setLogAppender((inboundEndpoint != null) ? inboundEndpoint.getArtifactContainerName() : "");
        OMElement inboundEndpointElement = InboundEndpointSerializer.serializeInboundEndpoint(inboundEndpoint);
        if (inboundEndpoint.getFileName() != null) {
            String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.INBOUND_ENDPOINT_DIR + File.separator + inboundEndpoint.getFileName();
            writeToFile(inboundEndpointElement, fileName);
            if (log.isDebugEnabled()) {
                log.debug("Restoring the Inbound Endpoint with name : " + artifactName + " : Completed");
            }
            log.info("Inbound Endpoint named '" + artifactName + "' has been restored");
        } else {
            handleSynapseArtifactDeploymentError("Couldn't restore the Inbound Endpoint named '" + artifactName + "', filename cannot be found");
        }
    } catch (Exception e) {
        handleSynapseArtifactDeploymentError("Restoring of the Inbound Endpoint named '" + artifactName + "' has failed", e);
    }
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) OMElement(org.apache.axiom.om.OMElement) DeploymentException(org.apache.axis2.deployment.DeploymentException)

Example 3 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipInboundErrorSequence.

public void testDebugManagerProcessCommandSetSkipInboundErrorSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_4");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator dispatchSeq = new SequenceMediator();
    dispatchSeq.addChild(in1);
    dispatchSeq.addChild(in2);
    dispatchSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator errorSeq = new SequenceMediator();
    errorSeq.addChild(out1);
    errorSeq.addChild(out2);
    errorSeq.addChild(out3);
    synConfig.addSequence("dispatch_4", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch_4");
    synConfig.addSequence("error_4", errorSeq);
    inboundEndpoint.setOnErrorSeq("error_4");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_4\",\"sequence-type\":\"inbound_faultseq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) errorSeq.getChild(0)).isSkipEnabled());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 4 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetBreakPointInboundErrorSequence.

public void testDebugManagerProcessCommandSetBreakPointInboundErrorSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_2");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator dispatchSeq = new SequenceMediator();
    dispatchSeq.addChild(in1);
    dispatchSeq.addChild(in2);
    dispatchSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator errorSeq = new SequenceMediator();
    errorSeq.addChild(out1);
    errorSeq.addChild(out2);
    errorSeq.addChild(out3);
    synConfig.addSequence("dispatch_1", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch_1");
    synConfig.addSequence("error_1", errorSeq);
    inboundEndpoint.setOnErrorSeq("error_1");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"breakpoint\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_2\",\"sequence-type\":\"inbound_faultseq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) errorSeq.getChild(0)).isBreakPoint());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Example 5 with InboundEndpoint

use of org.apache.synapse.inbound.InboundEndpoint in project wso2-synapse by wso2.

the class DebugManagerTest method testDebugManagerProcessCommandSetSkipInboundSequence.

public void testDebugManagerProcessCommandSetSkipInboundSequence() throws Exception {
    InboundEndpoint inboundEndpoint = new InboundEndpoint();
    inboundEndpoint.setName("test_inbound_3");
    TestMediator in1 = new TestMediator();
    TestMediator in2 = new TestMediator();
    TestMediator in3 = new TestMediator();
    SequenceMediator dispatchSeq = new SequenceMediator();
    dispatchSeq.addChild(in1);
    dispatchSeq.addChild(in2);
    dispatchSeq.addChild(in3);
    TestMediator out1 = new TestMediator();
    TestMediator out2 = new TestMediator();
    TestMediator out3 = new TestMediator();
    SequenceMediator errorSeq = new SequenceMediator();
    errorSeq.addChild(out1);
    errorSeq.addChild(out2);
    errorSeq.addChild(out3);
    synConfig.addSequence("dispatch_3", dispatchSeq);
    inboundEndpoint.setInjectingSeq("dispatch_3");
    synConfig.addSequence("error_3", errorSeq);
    inboundEndpoint.setOnErrorSeq("error_3");
    synConfig.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
    String debug_command = "{\"command\":\"set\",\"command-argument\":\"skip\",\"mediation-component\":\"sequence\"," + "\"sequence\":{\"inbound\":{\"inbound-key\":\"test_inbound_3\",\"sequence-type\":\"inbound_seq\",\"mediator-position\":\"0\"}}}";
    dm.processDebugCommand(debug_command);
    assertTrue(((AbstractMediator) dispatchSeq.getChild(0)).isSkipEnabled());
}
Also used : InboundEndpoint(org.apache.synapse.inbound.InboundEndpoint) TestMediator(org.apache.synapse.mediators.TestMediator) SequenceMediator(org.apache.synapse.mediators.base.SequenceMediator)

Aggregations

InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)21 SynapseException (org.apache.synapse.SynapseException)6 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)6 OMElement (org.apache.axiom.om.OMElement)5 DeploymentException (org.apache.axis2.deployment.DeploymentException)4 ProxyService (org.apache.synapse.core.axis2.ProxyService)4 TestMediator (org.apache.synapse.mediators.TestMediator)4 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)4 AspectConfiguration (org.apache.synapse.aspects.AspectConfiguration)3 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)3 Endpoint (org.apache.synapse.endpoints.Endpoint)3 MessageProcessor (org.apache.synapse.message.processor.MessageProcessor)3 MessageStore (org.apache.synapse.message.store.MessageStore)3 API (org.apache.synapse.rest.API)3 File (java.io.File)2 Iterator (java.util.Iterator)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 ManagedLifecycle (org.apache.synapse.ManagedLifecycle)2 Mediator (org.apache.synapse.Mediator)2 Entry (org.apache.synapse.config.Entry)2