AddressEndpoint endpoint = new AddressEndpoint(); endpoint.setEnableMBeanStats(false); endpoint.setName("DYNAMIC_RECIPIENT_LIST_EP_" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setReplicationDisabled(true); definition.setAddress(url); endpoint.setDefinition(definition); endpoint.init(env);
@Override protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { AddressEndpoint addressEndpoint = new AddressEndpoint(); OMAttribute name = epConfig.getAttribute( new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); if (name != null) { addressEndpoint.setName(name.getAttributeValue()); } OMElement addressElement = epConfig.getFirstChildWithName( new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address")); if (addressElement != null) { EndpointDefinition definition = createEndpointDefinition(addressElement); addressEndpoint.setDefinition(definition); processAuditStatus(definition, addressEndpoint.getName(), addressElement); } processProperties(addressEndpoint, epConfig); return addressEndpoint; }
public void send(MessageContext synCtx) { if (getParentEndpoint() == null && !readyToSend()) { // if the this leaf endpoint is too a root endpoint and is in inactive informFailure(synCtx, SynapseConstants.ENDPOINT_ADDRESS_NONE_READY, "Currently , Address endpoint : " + getContext()); } else { super.send(synCtx); } } }
public void onFault(MessageContext synCtx) { // is this really a fault or a timeout/connection close etc? if (isTimeout(synCtx)) { getContext().onTimeout(); } else if (isSuspendFault(synCtx)) { getContext().onFault(); } // this should be an ignored error if we get here setErrorOnMessage(synCtx, null, null); super.onFault(synCtx); }
/** * Create a Endpoint for a given URL * * @param endpointUrl URL * @param se synapse environment * @return AddressEndpoint address endpoint */ private Endpoint getEndpointFromURL(String endpointUrl, SynapseEnvironment se) { AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition def = new EndpointDefinition(); def.setAddress(endpointUrl.trim()); endpoint.setDefinition(def); endpoint.init(se); return endpoint; }
AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment()); endpoint.send(synCtx); } else { log.error("Cannot load balance for non-HTTP/S transport " + transport);
endpoint = new AddressEndpoint(); endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress(serviceURL); ((AddressEndpoint) endpoint).setDefinition(endpointDefinition); isWrappingEndpointCreated = true; } else if (endpoint == null) {
private List<Endpoint> createEndpoints() { List<Endpoint> endpoints = new ArrayList<Endpoint>(); for (int i = 0; i < hosts.length; i++) { AddressEndpoint addressEndpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); definition.setAddress("http://" + hosts[i] + "/"); addressEndpoint.setDefinition(definition); MediatorProperty property = new MediatorProperty(); property.setName(WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT); property.setValue(weights[i]); addressEndpoint.addProperty(property); endpoints.add(addressEndpoint); } return endpoints; } }
@Override protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof AddressEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint; EndpointDefinition epAddress = addressEndpoint.getDefinition(); OMElement addressElement = serializeEndpointDefinition(epAddress); endpointElement.addChild(addressElement); // serialize the properties serializeProperties(addressEndpoint, endpointElement); //serialize attributes serializeCommonAttributes(endpoint, endpointElement); return endpointElement; }
public void testContextProperties() throws Exception { SynapseXPath xpath = new SynapseXPath("$ctx:timeout"); AbstractEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); definition.setDynamicTimeoutExpression(xpath); MessageContext synCtx = new TestMessageContext(); synCtx.setProperty("timeout", "90000"); assertEquals(Long.valueOf((String) xpath.evaluate(synCtx)).longValue(), endpoint.getDefinition().evaluateDynamicEndpointTimeout(synCtx)); }
public void onSuccess() { if (getContext() != null) { getContext().onSuccess(); } }
if (epr instanceof AddressEndpoint) { firstTwoRoundsResults[i] = ((AddressEndpoint)epr).getProperty( WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT).getValue(); if (epr instanceof AddressEndpoint) { secondTwoRoundsResults[i] = ((AddressEndpoint)epr).getProperty( WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT).getValue();
AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition definition = new EndpointDefinition(); endpoint.setDefinition(definition); endpoint.init(synCtx.getEnvironment()); endpoint.send(synCtx); } else { log.error("Cannot load balance for non-HTTP/S transport " + transport);
/** * Tests building a proxy service with an unreachable endpoint specified as the published wsdl url with the * 'enablePublishWSDLSafeMode' set to true. * * @throws Exception if an error occurs when converting the URI string to a URI */ public void testBuildAxisServiceWithUnreachableWsdlEndpointWithPublishWSDLSafeModeDisabled() throws Exception { SynapseConfiguration synCfg = new SynapseConfiguration(); AxisConfiguration axisCfg = new AxisConfiguration(); ProxyService proxyService = new ProxyService("faultyPublishWsdlEndpointProxyWithPublishWSDLSafeModeDisabled"); proxyService.setPublishWSDLEndpoint("wsdlEndPoint"); AddressEndpoint wsdlEndpoint = new AddressEndpoint(); EndpointDefinition endpointDefinition = new EndpointDefinition(); endpointDefinition.setAddress((new URI("http://invalid-host/SimpleStockService.wsdl")).toString()); wsdlEndpoint.setDefinition(endpointDefinition); proxyService.addParameter("enablePublishWSDLSafeMode", false); synCfg.addEndpoint("wsdlEndPoint", wsdlEndpoint); try { proxyService.buildAxisService(synCfg, axisCfg); Assert.fail("Axis service built with an unreachable wsdl endpoint should throw fault"); } catch (SynapseException e) { Assert.assertTrue("Unexpected exception thrown: " + e, e.getMessage().contains("Error reading from wsdl URI")); } }
public void onFault(MessageContext synCtx) { // For setting Car name (still for Proxy) logSetter(); // is this really a fault or a timeout/connection close etc? if (isTimeout(synCtx)) { getContext().onTimeout(); } else if (isSuspendFault(synCtx)) { getContext().onFault(); } // this should be an ignored error if we get here setErrorOnMessage(synCtx, null, null); super.onFault(synCtx); }
/** * Create a Endpoint for a given URL * * @param endpointUrl URL * @param se synapse environment * @return AddressEndpoint address endpoint */ private Endpoint getEndpointFromURL(String endpointUrl, SynapseEnvironment se) { AddressEndpoint endpoint = new AddressEndpoint(); EndpointDefinition def = new EndpointDefinition(); def.setAddress(endpointUrl.trim()); endpoint.setDefinition(def); endpoint.init(se); return endpoint; }
@Override protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof AddressEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint; EndpointDefinition epAddress = addressEndpoint.getDefinition(); OMElement addressElement = serializeEndpointDefinition(epAddress); endpointElement.addChild(addressElement); // serialize the properties serializeProperties(addressEndpoint, endpointElement); //serialize attributes serializeCommonAttributes(endpoint, endpointElement); return endpointElement; }
/** * Creates a basic EndpointView with a given number of children added to the endpoint. * * @param numberOfChildren the child endpoints inside the endpoint attached to the end point view. If * specified as 0, the children list will be null * @return the created end point view */ private EndpointView createEndPointView(int numberOfChildren) { AbstractEndpoint endpoint = new AddressEndpoint(); MessageContext synCtx = new TestMessageContext(); synCtx.setConfiguration(new SynapseConfiguration()); SynapseEnvironment environment = new Axis2SynapseEnvironment( new ConfigurationContext(new AxisConfiguration()), synCtx.getConfiguration()); if (numberOfChildren > 0) { List<Endpoint> children = new ArrayList<>(numberOfChildren); for (int i = 0; i < numberOfChildren; i++) { AbstractEndpoint child = new AddressEndpoint(); child.init(environment); child.setEnableMBeanStats(true); child.setName("endpoint" + i); children.add(child); } endpoint.setChildren(children); } endpoint.init(environment); return new EndpointView("endpoint", endpoint); }
public void onSuccess() { if (getContext() != null) { getContext().onSuccess(); } }
AddressEndpoint endpoint = new AddressEndpoint(); endpoint.setEnableMBeanStats(false); endpoint.setName("DYNAMIC_RECIPIENT_LIST_EP_" + UUID.randomUUID()); EndpointDefinition definition = new EndpointDefinition(); definition.setReplicationDisabled(true); definition.setAddress(url); endpoint.setDefinition(definition); endpoint.init(env);