本文整理汇总了Java中org.apache.synapse.endpoints.Endpoint类的典型用法代码示例。如果您正苦于以下问题:Java Endpoint类的具体用法?Java Endpoint怎么用?Java Endpoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Endpoint类属于org.apache.synapse.endpoints包,在下文中一共展示了Endpoint类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerDeployer
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
/**
* Registers the Endpoint deployer.
*
* @param axisConfig AxisConfiguration to which this deployer belongs
* @param synapseEnvironment SynapseEnvironment to which this deployer belongs
*/
private void registerDeployer(AxisConfiguration axisConfig,
SynapseEnvironment synapseEnvironment)
throws TenantAwareLoadBalanceEndpointException {
SynapseConfiguration synCfg = synapseEnvironment
.getSynapseConfiguration();
DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig
.getConfigurator();
SynapseArtifactDeploymentStore deploymentStore = synCfg
.getArtifactDeploymentStore();
String synapseConfigPath = ServiceBusUtils
.getSynapseConfigAbsPath(synapseEnvironment
.getServerContextInformation());
String endpointDirPath = synapseConfigPath + File.separator
+ MultiXMLConfigurationBuilder.ENDPOINTS_DIR;
for (Endpoint ep : synCfg.getDefinedEndpoints().values()) {
if (ep.getFileName() != null) {
deploymentStore.addRestoredArtifact(endpointDirPath
+ File.separator + ep.getFileName());
}
}
deploymentEngine.addDeployer(new EndpointDeployer(), endpointDirPath,
ServiceBusConstants.ARTIFACT_EXTENSION);
}
示例2: getEndpoint
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
/**
* @param to get an endpoint to send the information
* @param member The member to which an EP has to be created
* @param synCtx synapse context
* @return the created endpoint
*/
private Endpoint getEndpoint(EndpointReference to, org.apache.axis2.clustering.Member member, MessageContext synCtx) {
AddressEndpoint endpoint = new AddressEndpoint();
endpoint.setEnableMBeanStats(false);
endpoint.setName("DLB:" + member.getHostName() +
":" + member.getPort() + ":" + UUID.randomUUID());
EndpointDefinition definition = new EndpointDefinition();
definition.setTimeoutAction(SynapseConstants.DISCARD_AND_FAULT);
definition.setTimeoutDuration(LoadBalancerConfiguration.getInstance().getEndpointTimeout());
definition.setReplicationDisabled(true);
definition.setAddress(to.getAddress());
endpoint.setDefinition(definition);
endpoint.init((SynapseEnvironment)
((Axis2MessageContext) synCtx).getAxis2MessageContext().
getConfigurationContext().getAxisConfiguration().
getParameterValue(SynapseConstants.SYNAPSE_ENV));
return endpoint;
}
示例3: prepareEndPointSequence
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
private void prepareEndPointSequence(MessageContext synCtx, Endpoint endpoint) {
Object o = synCtx.getProperty(SynapseConstants.PROP_SAL_ENDPOINT_ENDPOINT_LIST);
List<Endpoint> endpointList;
if (o instanceof List) {
endpointList = (List<Endpoint>) o;
endpointList.add(this);
} else {
// this is the first endpoint in the hierarchy. so create the queue and
// insert this as the first element.
endpointList = new ArrayList<Endpoint>();
endpointList.add(this);
synCtx.setProperty(SynapseConstants.PROP_SAL_ENDPOINT_ENDPOINT_LIST, endpointList);
}
// if the next endpoint is not a session affinity one, endpoint sequence ends
// here. but we have to add the next endpoint to the list.
if (!(endpoint instanceof TenantAwareLoadBalanceEndpoint)) {
endpointList.add(endpoint);
// Clearing out if there any any session information with current message
if (dispatcher.isServerInitiatedSession()) {
dispatcher.removeSessionID(synCtx);
}
}
}
示例4: getEndpoint
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
public Endpoint getEndpoint(String endpoint) {
if (endpointHashMap.get(endpoint) != null) {
endpointHashMap.get(endpoint).lastAccessTime = System.currentTimeMillis();
return endpointHashMap.get(endpoint).endpoint;
} else {
return null;
}
}
示例5: createEndpoint
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
public static Endpoint createEndpoint(String addressURI, SynapseEnvironment environment) {
if (EndpointHolder.getInstance().getEndpoint(addressURI) != null) {
return EndpointHolder.getInstance().getEndpoint(addressURI);
} else {
address.addAttribute("uri", addressURI, null);
endpoint.addChild(address);
Endpoint ep = EndpointFactory.getEndpointFromElement(endpoint, true, null);
ep.init(environment);
EndpointHolder.getInstance().putEndpoint(addressURI, ep);
return ep;
}
}
示例6: EndpointRef
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
EndpointRef(Endpoint endpoint) {
this.endpoint = endpoint;
}
示例7: putEndpoint
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
public void putEndpoint(String endpointKey, Endpoint endpoint) {
endpointHashMap.put(endpointKey, new EndpointRef(endpoint));
}
示例8: sendToApplicationMember
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
protected void sendToApplicationMember(MessageContext synCtx,
org.apache.axis2.clustering.Member currentMember,
DynamicLoadbalanceFaultHandler faultHandler,
boolean newSession) {
//Rewriting the URL
org.apache.axis2.context.MessageContext axis2MsgCtx =
((Axis2MessageContext) synCtx).getAxis2MessageContext();
//Removing the REST_URL_POSTFIX - this is a hack.
//In this load balance endpoint we create an endpoint per request by setting the complete url as the address.
//If a REST message comes Axis2FlexibleMEPClient append the REST_URL_POSTFIX to the address. Hence endpoint fails
//do send the request. e.g. http://localhost:8080/example/index.html/example/index.html
axis2MsgCtx.removeProperty(NhttpConstants.REST_URL_POSTFIX);
String transport = axis2MsgCtx.getTransportIn().getName();
EndpointReference to = getEndpointReferenceAfterURLRewrite(synCtx, currentMember, transport);
synCtx.setTo(to);
Endpoint endpoint = getEndpoint(to, currentMember, synCtx);
// Push fault handler to manage statistics and fail-over logic
faultHandler.setTo(to);
faultHandler.setCurrentMember(currentMember);
faultHandler.setCurrentEp(endpoint);
synCtx.pushFaultHandler(faultHandler);
synCtx.getEnvelope().build();
if (isSessionAffinityBasedLB()) {
synCtx.setProperty(SynapseConstants.PROP_SAL_ENDPOINT_DEFAULT_SESSION_TIMEOUT, getSessionTimeout());
synCtx.setProperty(SynapseConstants.PROP_SAL_ENDPOINT_CURRENT_DISPATCHER, dispatcher);
if (newSession) {
prepareEndPointSequence(synCtx, endpoint);
synCtx.setProperty(SynapseConstants.PROP_SAL_ENDPOINT_CURRENT_MEMBER, currentMember);
// we should also indicate that this is the first message in the session. so that
// onFault(...) method can resend only the failed attempts for the first message.
synCtx.setProperty(SynapseConstants.PROP_SAL_ENDPOINT_FIRST_MESSAGE_IN_SESSION,
Boolean.TRUE);
}
}
Map<String, String> memberHosts;
if ((memberHosts = (Map<String, String>) currentMember.getProperties().get(HttpSessionDispatcher.HOSTS)) == null) {
currentMember.getProperties().put(HttpSessionDispatcher.HOSTS,
memberHosts = new HashMap<String, String>());
}
memberHosts.put(extractTargetHost(synCtx), "true");
setupTransportHeaders(synCtx);
setupLoadBalancerContextProperties(synCtx, currentMember);
try {
if (log.isDebugEnabled()) {
log.debug(String.format("Sending request %s to endpoint: %s", synCtx.getMessageID(), to.getAddress()));
}
endpoint.send(synCtx);
// Increment in-flight request count
incrementInFlightRequestCount(synCtx);
} catch (Exception e) {
if (e.getMessage().toLowerCase().contains("io reactor shutdown")) {
log.fatal("System cannot continue normal operation. Restarting", e);
System.exit(121); // restart
} else {
throw new SynapseException(e);
}
}
}
示例9: setCurrentEp
import org.apache.synapse.endpoints.Endpoint; //导入依赖的package包/类
@Override
public void setCurrentEp(Endpoint currentEp) {
this.currentEp = currentEp;
}