Details
-
Improvement
-
Status: Open
-
Trivial
-
Resolution: Unresolved
-
None
-
None
Description
A message exchange in PollingEndpoint.java's Poll method cannot be sent because the endpoint has yet to have been activated at that point. A meaningful exception would help.
This example code is an endpoint class derived from PollingEndpoint that gives a null pointer exception which isn't very meaningful.
public void poll() throws Exception
{ invokeIdentityService(); }private boolean invokeIdentityService() throws MessagingException {
ComponentContext ctx = getServiceUnit().getComponent().getComponentContext();
QName identityService = new QName("http://servicemix.apache.org/servicemanagerassembly",
"httpService");
InOut identityExchange = exchangeFactory.createInOutExchange();
configureTarget("Identity Service", identityExchange, ctx,
null, identityService, "soap", "");
NormalizedMessage in = identityExchange.createMessage();
in.setContent(new StringSource("Testing"));
identityExchange.setInMessage(in);
sendSync(identityExchange);
NormalizedMessage out = identityExchange.getOutMessage();
boolean login = false;
if (out != null)
else
{ // TODO: how should we handle faults }done(identityExchange);
return login;
}
public void configureTarget(String serviceDesc, MessageExchange
exchange, ComponentContext context, QName _interface, QName service,
String endpoint, String uri) throws MessagingException {
if (_interface == null && service == null && uri == null)
{ throw new MessagingException(serviceDesc + ": interface, service or uri should be specified"); }/*if (uri != null)
{ URIResolver.configureExchange(exchange, context, uri); }*/
if (_interface != null)
if (service != null) {
exchange.setService(service);
if (endpoint != null)
}
}