Hi Stephan,
You can invoke CrmService(cxfse-su) directly from your
OrderService(cxfse-su), the CrmService (cxfbc-su) is unnecessary.
Use sendMessage method in you OrderService(cxfse-su) you can invoke
CrmService(cxfse-su), just pass in the
servicename/endpointName/interface of CrmService(cxfse-su) as parameter
should be fine.
Regards
Freeman
Crimor wrote:
Hi Freeman,
yes the OrderService is declared as a consumer. I thought if i send a
message from OrderService to CrmService (cxfbc-su), the OrderService would
act like a client.
OrderService cxfbc-su
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:order="http://xxx.xxx.net/orderservice/v1/">
<bean
class="net.xxx.xxx.common.util.spring.StagePropertiesPlaceholderConfigurer"/>
<cxfbc:consumer
wsdl="classpath:orderService.wsdl"
targetService="order:OrderService"
targetInterface="order:orderServicePort"
timeout="${xxx.components.cxf-bc.timeout}"
locationURI="${xxx.components.order.service.soapurl}"
/>
</beans>
The intension was, that we can contact CRMService also directly over a
client, like the OrderService.
Is it possible to have a cxfbc:consumer and a cxfbc:provider defined in the
xbean.xml at same time?
My understanding:
client ---> Orderservice (cxfbc-su) ----> Orderservice (cxfse-su) --->
client | OrderService = consumer
client ---> CRMService(cxfbc-su) ---> CRMService (cxfse-su) ----> client |
CRMService = consumer
At time, it is like following:
client ---> OrderService(cxfbc-su) ----> Orderservice (cxfse-su) ---->
CRMServic (cxfbc-su) ---> CRMService (cxfse-su) ---> client |
OrderService(cxfbc-su) = consumer and CRMService = consumer
Orderservice cxfse-su
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0">
<bean
class="net.xxxx.xxxx.common.util.spring.StagePropertiesPlaceholderConfigurer"/>
<import
resource="classpath:net/xxx/xxx/components/order/springBeans.xml"/>
<cxfse:endpoint>
<cxfse:pojo>
<bean class="net.xxx.xxx.components.orderservice.OrderServiceImpl">
<property name="crmProxy" ref="crmProxy"/>
<property name="mptProxy" ref="mptProxy"/>
<property name="dartProxy" ref="dartProxy"/>
<property name="orderResponse" ref="orderResponse"/>
<property name="dummyResponses" ref="dummyResponses"/>
<property name="orderTransformer" ref="orderTransformer"/>
<property name="requestValidator" ref="requestValidator"/>
<property name="crmOrderValidator" ref="crmOrderValidator"/>
<property name="errorHandler" ref="errorHandler"/>
<property name="transformationService" ref="transformationService"/>
<property name="serviceLogger" ref="serviceLogger"/>
</bean>
</cxfse:pojo>
</cxfse:endpoint>
<bean id="orderTransformer"
class="net.xxx.xxx.components.orderservice.routing.TransformationProxy"
parent="baseProxy"/>
<bean id="dateUtil"
class="net.xxx.xxxx.common.util.domain.DateUtil"/>
<bean id="crmProxy"
class="net.xxx.xxx.components.orderservice.routing.CRMProxy"
parent="baseProxy">
<property name="orderStateMapper" ref="orderStateMapper"/>
</bean>
<bean id="mptProxy"
class="net.xxx.xxx.components.orderservice.routing.MPTProxy"
parent="baseProxy"/>
<bean id="dartProxy"
class="net.xxxx.xxxx.components.orderservice.routing.DARTProxy"
parent="baseProxy">
</bean>
<bean id="baseProxy"
class="net.xxx.xxx.components.orderservice.routing.BaseProxy"
abstract="true">
<property name="jbiWrapper" ref="jbiWrapper"/>
<property name="dateUtil" ref="dateUtil"/>
<property name="transformer" ref="transformationService"/>
<property name="context" ref="context"/>
<property name="errorHandler" ref="errorHandler"/>
</bean>
</beans>
CRMService cxfse-su
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0">
<!-- load all beans from a distinct file which is also used within the
JUnit Tests -->
<import resource="classpath:net/xxx/xxx/components/crm/springBeans.xml"/>
<cxfse:endpoint>
<cxfse:pojo>
<bean class="net.xxx.xxx.components.crmservice.CRMServiceImpl" >
<property name="aladdinOrderService" ref="aladdinService"/>
<property name="aladdinCompanyService" ref="companyService"/>
<property name="aladdinPersonService" ref="personService"/>
<property name="aladdinOrderItemService" ref="orderItemService"/>
<property name="aladdinUserService" ref="userService"/>
<property name="errorHandler" ref="errorHandler"/>
</bean>
</cxfse:pojo>
</cxfse:endpoint>
</beans>
Freeman Fang wrote:
Hi Stephan,
The threaddump shows the lots of threads are waiting for the sendSync
return, how about you use send instead.
And I'm confused with your flow, would you please append all your
configuration for each endpoint?
For example,
the configuration for cxfbc-su OrderService ... it should be a
consumer, right
the configuration for cxfse-su OrderService ...
the configuration for cxfbc-su CRMService ... what's this? only
provider is valid here but I can't see you have an external service,
this endpoint confused me,
the configuration for cxfse-su CRMService ...
Freeman
Crimor wrote:
Hi,
the Threaddump is quit large
http://www.nabble.com/file/p19664362/Threaddump.txt Threaddump.txt .
Greetings
stephan
Freeman Fang wrote:
Hi,
Would you please dump thread stack trace when the process hang?
Regards
Freeman
Crimor wrote:
Hi,
I have a cxfse-su Orderservice which should send a message to an
cxfbc-su
CRMService. This works fine on low traffic but if on high traffic it
seems
that the sendSync hangs up.
So I started an JMeter load tests and I take only 3 users which cause
500
request and everything works fine but if I increase the users to > 4 it
seems that the sendsync hangs up. Without the sendSync and both
services
testet separately the cxf OrderService and cxf CRMService works fine
within
50 users performing 1000 requests.
Flow:
client ---> cxfbc-su OrderService --> cxfse-su OrderService
---sendSync-->
cxfbc-su CRMService ---> cxfse-su CRMService --- reponse to -->
cxfse-su
OrderService --response to -> client
CXF-BC CRMSERVICE xbean.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:order="http://test.net/crmservice/v1/">
<!-- Loads the configuration-->
<bean
class="xxx.xxx.xxxx.common.util.spring.StagePropertiesPlaceholderConfigurer"/>
<cxfbc:consumer
wsdl="classpath:crmService.wsdl"
targetService="order:CRMService"
targetInterface="order:crmServicePort"
timeout="${xxx.components.cxf-bc.timeout}"
locationURI="${xxx.components.crm.service.soapurl}"/>
</beans>
The CXF OrderService send method:
protected Source sendMessage(Source xmlMessage, QName serviceName,
QName
interfaceName, QName operationName)
throws AdFusionException {
ServiceMixClient client = new ServiceMixClientFacade(context);
NormalizedMessage message = null;
InOut exchange = null;
try {
exchange = client.createInOutExchange();
message = exchange.getInMessage();
message.setContent(xmlMessage);
exchange.setService(serviceName);
exchange.setInterfaceName(interfaceName);
exchange.setOperation(operationName);
// sending the message
client.sendSync(exchange);
} catch (MessagingException e) {
StringBuilder sb = new StringBuilder();
logger.error("sendMessage() - " + sb.toString(), e);
throw new AdFusionException(sb.toString(), e);
}
// retrieving the answer
// logger.info("sendMessage() - exchange: " + exchange);
// logger.info("sendMessage() - exchange.getOutMessage(): " +
exchange.getOutMessage());
Source source = getContentFromMessage(exchange);
try {
client.done(exchange);
} catch (MessagingException e) {
String msg = "Error setting status of response to
ExchangeStatus.DONE";
logger.error("sendMessage() - " + msg + ": " + e.getMessage());
} finally {
try {
client.close();
} catch (JBIException e) {
String msg = "Error closing client";
logger.error("sendMessage() - " + msg + ": " + e.getMessage());
}
}
if (source == null) {
throw new AdFusionException("Source could not be retrieved from
exchange.");
}
return source;
}
private StringSource getContentFromMessage(InOut exchange) {
Source source = null;
if (exchange != null) {
if (exchange.getFault() != null) {
Fault fault = exchange.getFault();
logger.debug("getContentFromMessage() - retrieving fault: " +
fault);
source = fault.getContent();
} else {
if (exchange.getOutMessage() != null) {
NormalizedMessage message = exchange.getOutMessage();
logger.debug("getContentFromMessage() - retrieving message: "
+
message);
source = message.getContent();
} else {
logger
.error("getContentFromMessage() - The CRM System did
not
answer, exchange.getOutMessage() and exchange.getFault() is null.
Please
check the CRM Log files.");
AdfError adfError =
errorHandler.getById(AdfErrorCode.NO_CRM_ANSWER);
throw new AdFusionException(AdfErrorCode.NO_CRM_ANSWER,
adfError);
}
}
} else {
logger.error("getContentFromMessage() - exchange was null");
}
String resource = jbiWrapper.sourceToString(source, false, false);
StringSource stringSource = new StringSource(resource);
logger.debug("getContentFromMessage() - Returned source: " +
resource);
return stringSource;
}
May you can help me?
Greetings
Stephan