You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by ma...@uk.bnpparibas.com on 2008/01/24 18:24:10 UTC
Could not find route for exchange: InOnly exception
hello all,
i realize this is a duplication of my other thread 'Re: error
while handling a file send by poller'
but i got no answer so i thought to change subject ... as mayb someone
else has found same exception
here's what i am trying to do
i have a file poller, which will send file to a wiretap.
the wiretap will call a file:sender to copy file to another directory,
and at the same time will forward the request to
my custom SE.
Now, the file gets copied to the end directory (so wiretap calls
file:sender successfully), however i am receiving this exception
ERROR - FileComponent - Failed to process file:
c:\servicemix-p
rojects\in\README4.txt. Reason: javax.jbi.messaging.MessagingException:
Could no
t find route for exchange: InOnly[
id: ID:10.102.130.33-117acc730fc-7:8
status: Active
role: provider
service: {http://www.servicemix.org/example}filehandler
in: null
] for service: {http://www.servicemix.org/example}filehandler and
interface: nul
l
javax.jbi.messaging.MessagingException: Could not find route for exchange:
InOnl
y[
id: ID:10.102.130.33-117acc730fc-7:8
status: Active
role: provider
service: {http://www.servicemix.org/example}filehandler
in: null
] for service: {http://www.servicemix.org/example}filehandler and
interface: nul
this is my 3 xbean.xml
******************************************** file su
*************************************************
<file:sender service="tut:file"
endpoint="sender"
directory="file:///c:/servicemix-projects/out/" >
<property name="marshaler">
<bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
</property>
</file:sender>
<file:poller service="tut:file"
endpoint="poller"
file="file:///c:/servicemix-projects/in/"
targetService="tut:wiretap">
<property name="marshaler">
<bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
</property>
</file:poller>
*********************************************** wiretap su
**************************************************
<beans xmlns:eip="http://servicemix.apache.org/eip/1.0"
xmlns:tut="urn:servicemix:tutorial"
xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
xmlns:ex="http://www.servicemix.org/example">
<eip:wire-tap service="tut:wiretap" endpoint="endpoint">
<eip:target>
<eip:exchange-target service="ex:filehandler"
endpoint="handler:Endpoint"/>
</eip:target>
<eip:inListener>
<eip:exchange-target service="tut:file" endpoint="sender" />
</eip:inListener>
</eip:wire-tap>
</beans>
******************************************* my custom se su
********************************************
<beans xmlns:hwse="http://org.apache.servicemix.tutorial/1.0"
xmlns:ex="http://www.servicemix.org/example">
<hwse:endpoint service="ex:filehandler" endpoint="handlerEndpoint"/>
</beans>
***************************************************************************************************************
and here's sourcecode of my se
public class MyEndpoint extends Endpoint implements ExchangeProcessor {
private ServiceEndpoint activated;
private DeliveryChannel channel;
private MessageExchangeFactory exchangeFactory;
/* (non-Javadoc)
* @see org.apache.servicemix.common.Endpoint#getRole()
*/
public Role getRole() {
return Role.PROVIDER;
}
public void activate() throws Exception {
logger = this.serviceUnit.getComponent().getLogger();
ComponentContext ctx =
getServiceUnit().getComponent().getComponentContext();
channel = ctx.getDeliveryChannel();
exchangeFactory = channel.createExchangeFactory();
activated = ctx.activateEndpoint(service, endpoint);
start();
}
public void deactivate() throws Exception {
stop();
ServiceEndpoint ep = activated;
activated = null;
ComponentContext ctx =
getServiceUnit().getComponent().getComponentContext();
ctx.deactivateEndpoint(ep);
}
public ExchangeProcessor getProcessor() {
return this;
}
public void validate() throws DeploymentException {
}
protected void send(MessageExchange me) throws MessagingException {
if (me.getRole() == MessageExchange.Role.CONSUMER &&
me.getStatus() == ExchangeStatus.ACTIVE) {
BaseLifeCycle lf = (BaseLifeCycle)
getServiceUnit().getComponent().getLifeCycle();
lf.sendConsumerExchange(me, (Endpoint) this);
} else {
channel.send(me);
}
}
protected void done(MessageExchange me) throws MessagingException {
me.setStatus(ExchangeStatus.DONE);
send(me);
}
protected void fail(MessageExchange me, Exception error) throws
MessagingException {
me.setError(error);
send(me);
}
public void start() throws Exception {
}
public void stop() {
}
public void process(MessageExchange exchange) throws Exception {
System.err.println("-------- Receiving Message --------");
// The component acts as a provider, this means that another
component has requested our service
// As this exchange is active, this is either an in or a fault
(out are send by this component)
if (exchange.getRole() == MessageExchange.Role.PROVIDER) {
// Check here if the mep is supported by this component
if (exchange instanceof InOut == false) {
throw new UnsupportedOperationException("Unsupported MEP: "
+ exchange.getPattern());
}
// In message
if (exchange.getMessage("in") != null) {
NormalizedMessage in = exchange.getMessage("in");
// TODO ... handle the in message
// If the MEP is an InOnly, RobustInOnly, you have to set
the exchange to DONE status
// else, you have to create an Out message and populate it
// For now, just echo back
NormalizedMessage out = exchange.createMessage();
out.setContent(in.getContent());
exchange.setMessage(out, "out");
channel.send(exchange);
// Fault message
} else if (exchange.getFault() != null) {
// TODO ... handle the fault
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
// This is not compliant with the default MEPs
} else {
throw new IllegalStateException("Provider exchange is
ACTIVE, but no in or fault is provided");
}
// The component acts as a consumer, this means this exchange is
received because
// we sent it to another component. As it is active, this is
either an out or a fault
// If this component does not create / send exchanges, you may
just throw an UnsupportedOperationException
} else if (exchange.getRole() == MessageExchange.Role.CONSUMER) {
// Exchange is finished
if (exchange.getStatus() == ExchangeStatus.DONE) {
return;
// Exchange has been aborted with an exception
} else if (exchange.getStatus() == ExchangeStatus.ERROR) {
return;
// Exchange is active
} else {
// Out message
if (exchange.getMessage("out") != null) {
// TODO ... handle the response
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
// Fault message
} else if (exchange.getFault() != null) {
// TODO ... handle the fault
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
// This is not compliant with the default MEPs
} else {
throw new IllegalStateException("Consumer exchange is
ACTIVE, but no out or fault is provided");
}
}
// Unknown role
} else {
throw new IllegalStateException("Unkown role: " +
exchange.getRole());
}
}
to my first impression, either i extend the wrong class or i have
configured my endpoint incorrectly..
anyone could help?
thanks and regards
marco
This communication is confidential, may be privileged and is meant only for the intended recipient. If you are
not the intended recipient, please notify the sender by reply and delete this message from your system. Any
unauthorised dissemination, distribution or copying hereof is prohibited.
BNP Paribas Fund Services UK Limited, BNP Paribas Trust Corporation UK Limited, BNP Paribas UK Limited,
BNP Paribas Commodity Futures Ltd and Investment Fund Services Limited are authorised and regulated by
the Financial Services Authority.
BNP Paribas, BNP Paribas Securities Services and BNP Paribas Private Bank are authorised by the CECEI
and AMF. BNP Paribas London Branch, BNP Paribas Securities Services London Branch and BNP Paribas
Private Bank London Branch are regulated by the Financial Services Authority for the conduct of their UK
business. BNP Paribas Securities Services London Branch is also a member of the London Stock Exchange.