Search in sources :

Example 1 with BlockingMsgSender

use of org.apache.synapse.message.senders.blocking.BlockingMsgSender in project wso2-synapse by wso2.

the class ScheduledMessageProcessor method initMessageSender.

private BlockingMsgSender initMessageSender(Map<String, Object> params) {
    String axis2repo = (String) params.get(ForwardingProcessorConstants.AXIS2_REPO);
    String axis2Config = (String) params.get(ForwardingProcessorConstants.AXIS2_CONFIG);
    sender = new BlockingMsgSender();
    if (axis2repo != null) {
        sender.setClientRepository(axis2repo);
    }
    if (axis2Config != null) {
        sender.setAxis2xml(axis2Config);
    }
    sender.init();
    return sender;
}
Also used : BlockingMsgSender(org.apache.synapse.message.senders.blocking.BlockingMsgSender)

Example 2 with BlockingMsgSender

use of org.apache.synapse.message.senders.blocking.BlockingMsgSender in project wso2-synapse by wso2.

the class CallMediator method init.

public void init(SynapseEnvironment synapseEnvironment) {
    this.synapseEnv = synapseEnvironment;
    if (endpoint != null) {
        endpoint.init(synapseEnvironment);
    }
    if (blocking) {
        try {
            configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(clientRepository != null ? clientRepository : DEFAULT_CLIENT_REPO, axis2xml != null ? axis2xml : DEFAULT_AXIS2_XML);
            blockingMsgSender = new BlockingMsgSender();
            blockingMsgSender.setConfigurationContext(configCtx);
            blockingMsgSender.init();
        } catch (AxisFault axisFault) {
            String msg = "Error while initializing the Call mediator";
            log.error(msg, axisFault);
            throw new SynapseException(msg, axisFault);
        }
    } else {
        synapseEnvironment.updateCallMediatorCount(true);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) BlockingMsgSender(org.apache.synapse.message.senders.blocking.BlockingMsgSender) SynapseException(org.apache.synapse.SynapseException)

Example 3 with BlockingMsgSender

use of org.apache.synapse.message.senders.blocking.BlockingMsgSender in project wso2-synapse by wso2.

the class CalloutMediator method init.

public void init(SynapseEnvironment synEnv) {
    try {
        configCtx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(clientRepository != null ? clientRepository : DEFAULT_CLIENT_REPO, axis2xml != null ? axis2xml : DEFAULT_AXIS2_XML);
        if (serviceURL != null) {
            serviceURL = changeEndPointReference(serviceURL);
        }
        blockingMsgSender = new BlockingMsgSender();
        blockingMsgSender.setConfigurationContext(configCtx);
        blockingMsgSender.init();
        EndpointDefinition endpointDefinition = null;
        if (serviceURL != null) {
            // If Service URL is specified, it is given the highest priority
            endpoint = new AddressEndpoint();
            endpointDefinition = new EndpointDefinition();
            endpointDefinition.setAddress(serviceURL);
            ((AddressEndpoint) endpoint).setDefinition(endpointDefinition);
            isWrappingEndpointCreated = true;
        } else if (endpoint == null && endpointKey == null) {
            // Use a default endpoint in this case - i.e. the To header
            endpoint = new DefaultEndpoint();
            endpointDefinition = new EndpointDefinition();
            ((DefaultEndpoint) endpoint).setDefinition(endpointDefinition);
            isWrappingEndpointCreated = true;
        }
        if (endpointDefinition != null && isSecurityOn()) {
            endpointDefinition.setSecurityOn(true);
            if (wsSecPolicyKey != null) {
                endpointDefinition.setWsSecPolicyKey(wsSecPolicyKey);
            } else {
                if (inboundWsSecPolicyKey != null) {
                    endpointDefinition.setInboundWsSecPolicyKey(inboundWsSecPolicyKey);
                }
                if (outboundWsSecPolicyKey != null) {
                    endpointDefinition.setOutboundWsSecPolicyKey(outboundWsSecPolicyKey);
                }
            }
        }
    } catch (AxisFault e) {
        String msg = "Error initializing callout mediator : " + e.getMessage();
        log.error(msg, e);
        throw new SynapseException(msg, e);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) BlockingMsgSender(org.apache.synapse.message.senders.blocking.BlockingMsgSender) AddressEndpoint(org.apache.synapse.endpoints.AddressEndpoint) DefaultEndpoint(org.apache.synapse.endpoints.DefaultEndpoint) SynapseException(org.apache.synapse.SynapseException) EndpointDefinition(org.apache.synapse.endpoints.EndpointDefinition)

Aggregations

BlockingMsgSender (org.apache.synapse.message.senders.blocking.BlockingMsgSender)3 AxisFault (org.apache.axis2.AxisFault)2 SynapseException (org.apache.synapse.SynapseException)2 AddressEndpoint (org.apache.synapse.endpoints.AddressEndpoint)1 DefaultEndpoint (org.apache.synapse.endpoints.DefaultEndpoint)1 EndpointDefinition (org.apache.synapse.endpoints.EndpointDefinition)1