I assume that you are trying to send an exchange from a pojo deployed on
jsr181 ?
I first thought you were trying to send an exchange *to* the pojo.

In such a case, you have to use sendSync.
This is a limitation due to the fact that the jsr181 component has no way to
give the answer back to the pojo.
You can also remove the setStatus line, because the status for a newly
create exchange is already ACTIVE.

Cheers,
Guillaume Nodet

On 6/14/06, Alessandro Fredianelli <[EMAIL PROTECTED]>
wrote:

trying to send the exchange when is active throws
java.lang.UnsupportedOperationException: Asynchonous send of active
exchanges are not supported
this is what i did:
DeliveryChannel channel = context.getDeliveryChannel();

InOnly exchange = channel.createExchangeFactory().createInOnlyExchange();

NormalizedMessage message = exchange.createMessage();

exchange.setInMessage(message);

message.setProperty("id", new Integer(1));

message.setContent(new StringSource("<example id='" + 1 + "'/>"));

log.debug("status="+exchange.getStatus().toString());

exchange.setStatus(ExchangeStatus.ACTIVE);

channel.send(exchange);

log.debug("sent");


----- Original Message -----
From: "Guillaume Nodet" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, June 14, 2006 11:42 AM
Subject: Re: javax.jbi.messaging.MessagingException: illegal exchange
status: done


> When you create and send a jbi exchange, the status must be ACTIVE.
> For an InOnly mep, the provider (the target component) will send it back
> with a DONE status.
>
> Cheers,
> Guillaume Nodet
>
> On 6/14/06, Alessandro Fredianelli <[EMAIL PROTECTED]>
> wrote:
>>
>> why doing this on a jsr181 exposed pojo
>>
>> DeliveryChannel channel = context.getDeliveryChannel();
>> InOnly exchange = channel.createExchangeFactory
().createInOnlyExchange();
>> NormalizedMessage message = exchange.createMessage();
>> exchange.setInMessage(message);
>> message.setProperty("id", new Integer(1));
>> message.setContent(new StringSource("<example id='" + 1 + "'/>"));
>> exchange.setStatus(ExchangeStatus.DONE);
>> channel.send(exchange);
>> log.debug("sent");
>>
>> throws javax.jbi.messaging.MessagingException: illegal exchange status:
>> done ?
>>
>


Reply via email to