outbound dispatching on the absence of error

View: New views
10 Messages — Rating Filter:   Alert me  

outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello list,

Using Mule 2.2.1 CE.

My use case is as follows:

- Quartz inbound periodically invokes my component A.
- Component A sends a payload to outbound router.
- Outbound router should:
    - try to send payload to outbound endpoint B,
    - if sending payload to B succeeds, invoke another component C
      via Vm endpoint,
    - if sending payload to B fails, log the error.

Which router/filter/exception-strategy combination can achive this
outbound dispatching behavior?

By the way, outbound endpoint B may either be File transport or
JMS transport, if this makes a difference.

Thanks in advance.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Following up to my own question.

When using File transport as my first outbound endpoint and chaining-router,
i.e.,

<outbound>
    <chaining-router>
        <file:outbound-endpoint name="fileout" path="/some/dir" />
        <vm:outbound-endpoint path="Success"/>
    </chaining-router>
</outbound>

Mule gives me warning:

  [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
  cannot process any further endpoints. There was no result returned from
  endpoint invocation: ...

and vm:outbound-endpoint is not fired.

I think this is because File transport is asynchronous (i.e., does not
return
any response back). It does not seem to be able to make File transport
synchronous, so that I can not use chaining-router?

-----Original Message-----
From: iwanek@... [mailto:iwanek@...]
Sent: Friday, October 16, 2009 12:09 PM
To: user@...
Subject: [mule-user] outbound dispatching on the absence of error

Hello list,

Using Mule 2.2.1 CE.

My use case is as follows:

- Quartz inbound periodically invokes my component A.
- Component A sends a payload to outbound router.
- Outbound router should:
    - try to send payload to outbound endpoint B,
    - if sending payload to B succeeds, invoke another component C
      via Vm endpoint,
    - if sending payload to B fails, log the error.

Which router/filter/exception-strategy combination can achive this
outbound dispatching behavior?

By the way, outbound endpoint B may either be File transport or
JMS transport, if this makes a difference.

Thanks in advance.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: outbound dispatching on the absence of error

by Stephen Fenech-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

The file transport is not "synchronous". When you try to make a
synchronous call, you will get back a null. And then the router will not
continue routing. What you could try to do is use a responseTransformer,
to change that null into something else... so that chaining router will
route that to the next endpoint.

Have not tried it myself but i think it should do the trick.

Stephen

iwanek@... wrote:

> Following up to my own question.
>
> When using File transport as my first outbound endpoint and chaining-router,
> i.e.,
>
> <outbound>
>     <chaining-router>
>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>         <vm:outbound-endpoint path="Success"/>
>     </chaining-router>
> </outbound>
>
> Mule gives me warning:
>
>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>   cannot process any further endpoints. There was no result returned from
>   endpoint invocation: ...
>
> and vm:outbound-endpoint is not fired.
>
> I think this is because File transport is asynchronous (i.e., does not
> return
> any response back). It does not seem to be able to make File transport
> synchronous, so that I can not use chaining-router?
>
> -----Original Message-----
> From: iwanek@... [mailto:iwanek@...]
> Sent: Friday, October 16, 2009 12:09 PM
> To: user@...
> Subject: [mule-user] outbound dispatching on the absence of error
>
> Hello list,
>
> Using Mule 2.2.1 CE.
>
> My use case is as follows:
>
> - Quartz inbound periodically invokes my component A.
> - Component A sends a payload to outbound router.
> - Outbound router should:
>     - try to send payload to outbound endpoint B,
>     - if sending payload to B succeeds, invoke another component C
>       via Vm endpoint,
>     - if sending payload to B fails, log the error.
>
> Which router/filter/exception-strategy combination can achive this
> outbound dispatching behavior?
>
> By the way, outbound endpoint B may either be File transport or
> JMS transport, if this makes a difference.
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for the suggestion.

But I am not sure what sort of response-transformer to setup.
I think it would be something like the following, but don't know
which transformer should go in the place of __HERE__?

<outbound>
  <chaining-router>
    <file:outbound-endpoint name="fileout" path="/some/dir"
synchronous="true">
      <response-transformers>
        <__HERE__/>
      </response-transformers>
    </file:outbound-endpoint>
    <vm:outbound-endpoint path="Success"/>
  </chaining-router>
</outbound>

I am not comfortable at all about writing a new custom transformer.
I'd very much like to reuse exsiting ones...

-----Original Message-----
From: Stephen Fenech [mailto:stephen.fenech@...]
Sent: Friday, October 16, 2009 7:53 PM
To: user@...
Subject: Re: [mule-user] outbound dispatching on the absence of error

Hi,

The file transport is not "synchronous". When you try to make a
synchronous call, you will get back a null. And then the router will not
continue routing. What you could try to do is use a responseTransformer,
to change that null into something else... so that chaining router will
route that to the next endpoint.

Have not tried it myself but i think it should do the trick.

Stephen

iwanek@... wrote:
> Following up to my own question.
>
> When using File transport as my first outbound endpoint and
chaining-router,

> i.e.,
>
> <outbound>
>     <chaining-router>
>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>         <vm:outbound-endpoint path="Success"/>
>     </chaining-router>
> </outbound>
>
> Mule gives me warning:
>
>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>   cannot process any further endpoints. There was no result returned from
>   endpoint invocation: ...
>
> and vm:outbound-endpoint is not fired.
>
> I think this is because File transport is asynchronous (i.e., does not
> return
> any response back). It does not seem to be able to make File transport
> synchronous, so that I can not use chaining-router?
>
> -----Original Message-----
> From: iwanek@... [mailto:iwanek@...]
> Sent: Friday, October 16, 2009 12:09 PM
> To: user@...
> Subject: [mule-user] outbound dispatching on the absence of error
>
> Hello list,
>
> Using Mule 2.2.1 CE.
>
> My use case is as follows:
>
> - Quartz inbound periodically invokes my component A.
> - Component A sends a payload to outbound router.
> - Outbound router should:
>     - try to send payload to outbound endpoint B,
>     - if sending payload to B succeeds, invoke another component C
>       via Vm endpoint,
>     - if sending payload to B fails, log the error.
>
> Which router/filter/exception-strategy combination can achive this
> outbound dispatching behavior?
>
> By the way, outbound endpoint B may either be File transport or
> JMS transport, if this makes a difference.
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: outbound dispatching on the absence of error

by Stephen Fenech-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So, i would typically put the response-transformer inside the
endpoint... I just prefare it that way ;) shorter...

<file:outbound-endpoint name="fileout" path="/some/dir"
synchronous="true" response-transformers="mytrans">

Now, if you do not like to write a custom transformer, how about groovy?

Stephen



iwanek@... wrote:

> Thank you for the suggestion.
>
> But I am not sure what sort of response-transformer to setup.
> I think it would be something like the following, but don't know
> which transformer should go in the place of __HERE__?
>
> <outbound>
>   <chaining-router>
>     <file:outbound-endpoint name="fileout" path="/some/dir"
> synchronous="true">
>       <response-transformers>
>         <__HERE__/>
>       </response-transformers>
>     </file:outbound-endpoint>
>     <vm:outbound-endpoint path="Success"/>
>   </chaining-router>
> </outbound>
>
> I am not comfortable at all about writing a new custom transformer.
> I'd very much like to reuse exsiting ones...
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Friday, October 16, 2009 7:53 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> Hi,
>
> The file transport is not "synchronous". When you try to make a
> synchronous call, you will get back a null. And then the router will not
> continue routing. What you could try to do is use a responseTransformer,
> to change that null into something else... so that chaining router will
> route that to the next endpoint.
>
> Have not tried it myself but i think it should do the trick.
>
> Stephen
>
> iwanek@... wrote:
>  
>> Following up to my own question.
>>
>> When using File transport as my first outbound endpoint and
>>    
> chaining-router,
>  
>> i.e.,
>>
>> <outbound>
>>     <chaining-router>
>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>         <vm:outbound-endpoint path="Success"/>
>>     </chaining-router>
>> </outbound>
>>
>> Mule gives me warning:
>>
>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>   cannot process any further endpoints. There was no result returned from
>>   endpoint invocation: ...
>>
>> and vm:outbound-endpoint is not fired.
>>
>> I think this is because File transport is asynchronous (i.e., does not
>> return
>> any response back). It does not seem to be able to make File transport
>> synchronous, so that I can not use chaining-router?
>>
>> -----Original Message-----
>> From: iwanek@... [mailto:iwanek@...]
>> Sent: Friday, October 16, 2009 12:09 PM
>> To: user@...
>> Subject: [mule-user] outbound dispatching on the absence of error
>>
>> Hello list,
>>
>> Using Mule 2.2.1 CE.
>>
>> My use case is as follows:
>>
>> - Quartz inbound periodically invokes my component A.
>> - Component A sends a payload to outbound router.
>> - Outbound router should:
>>     - try to send payload to outbound endpoint B,
>>     - if sending payload to B succeeds, invoke another component C
>>       via Vm endpoint,
>>     - if sending payload to B fails, log the error.
>>
>> Which router/filter/exception-strategy combination can achive this
>> outbound dispatching behavior?
>>
>> By the way, outbound endpoint B may either be File transport or
>> JMS transport, if this makes a difference.
>>
>> Thanks in advance.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Within 3 minutes! Wow! Thanks!

Groovy... now you are pushing me far far out the sea...

I see some examples using <scripting:transformer ...> on the net.
Is this what you have in mind?

Thanks.

-----Original Message-----
From: Stephen Fenech [mailto:stephen.fenech@...]
Sent: Monday, October 19, 2009 7:43 PM
To: user@...
Subject: Re: [mule-user] outbound dispatching on the absence of error

So, i would typically put the response-transformer inside the endpoint... I
just prefare it that way ;) shorter...

<file:outbound-endpoint name="fileout" path="/some/dir"
synchronous="true" response-transformers="mytrans">

Now, if you do not like to write a custom transformer, how about groovy?

Stephen



iwanek@... wrote:

> Thank you for the suggestion.
>
> But I am not sure what sort of response-transformer to setup.
> I think it would be something like the following, but don't know which
> transformer should go in the place of __HERE__?
>
> <outbound>
>   <chaining-router>
>     <file:outbound-endpoint name="fileout" path="/some/dir"
> synchronous="true">
>       <response-transformers>
>         <__HERE__/>
>       </response-transformers>
>     </file:outbound-endpoint>
>     <vm:outbound-endpoint path="Success"/>
>   </chaining-router>
> </outbound>
>
> I am not comfortable at all about writing a new custom transformer.
> I'd very much like to reuse exsiting ones...
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Friday, October 16, 2009 7:53 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> Hi,
>
> The file transport is not "synchronous". When you try to make a
> synchronous call, you will get back a null. And then the router will
> not continue routing. What you could try to do is use a
> responseTransformer, to change that null into something else... so
> that chaining router will route that to the next endpoint.
>
> Have not tried it myself but i think it should do the trick.
>
> Stephen
>
> iwanek@... wrote:
>  
>> Following up to my own question.
>>
>> When using File transport as my first outbound endpoint and
>>    
> chaining-router,
>  
>> i.e.,
>>
>> <outbound>
>>     <chaining-router>
>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>         <vm:outbound-endpoint path="Success"/>
>>     </chaining-router>
>> </outbound>
>>
>> Mule gives me warning:
>>
>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>   cannot process any further endpoints. There was no result returned from
>>   endpoint invocation: ...
>>
>> and vm:outbound-endpoint is not fired.
>>
>> I think this is because File transport is asynchronous (i.e., does
>> not return any response back). It does not seem to be able to make
>> File transport synchronous, so that I can not use chaining-router?
>>
>> -----Original Message-----
>> From: iwanek@... [mailto:iwanek@...]
>> Sent: Friday, October 16, 2009 12:09 PM
>> To: user@...
>> Subject: [mule-user] outbound dispatching on the absence of error
>>
>> Hello list,
>>
>> Using Mule 2.2.1 CE.
>>
>> My use case is as follows:
>>
>> - Quartz inbound periodically invokes my component A.
>> - Component A sends a payload to outbound router.
>> - Outbound router should:
>>     - try to send payload to outbound endpoint B,
>>     - if sending payload to B succeeds, invoke another component C
>>       via Vm endpoint,
>>     - if sending payload to B fails, log the error.
>>
>> Which router/filter/exception-strategy combination can achive this
>> outbound dispatching behavior?
>>
>> By the way, outbound endpoint B may either be File transport or JMS
>> transport, if this makes a difference.
>>
>> Thanks in advance.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: outbound dispatching on the absence of error

by Stephen Fenech-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So,

I did some testing, so that I make sure that I am not sending you in the
wrong direction, and funnily enough, found a much simpler solution which
I was not expecting. I am using Mule 2.2.1 like you and the following
worked:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
xmlns:script="http://www.mulesource.org/schema/mule/scripting/2.2"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.2
http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/vm/2.2
http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
http://www.mulesource.org/schema/mule/scripting/2.2
http://www.mulesource.org/schema/mule/scripting/2.2/mule-scripting.xsd
http://www.mulesource.org/schema/mule/file/2.2
http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd">

<file:connector name="fileConnector" streaming="false" autoDelete="true"/>
<vm:connector name="vmConnector" queueEvents="true"/>

<model>

<service name="chainingService">
<inbound>
<vm:inbound-endpoint path="fromTest"/>
</inbound>
<log-component/>
<outbound>
<chaining-router>
<vm:outbound-endpoint path="internal"/>
<vm:outbound-endpoint path="toTest"/>
</chaining-router>
</outbound>
</service>

<service name="fileWriter">
<inbound>
<vm:inbound-endpoint path="internal" synchronous="true"/>
</inbound>
<log-component/>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="chainnull"/>
</pass-through-router>
</outbound>
</service>


</model>

</mule>

The trick seems to be to have that extra vm hop in order to use the vm
synchronous behaviour rather than the file. So basically, the following
test was successfull!

package com.ricston.blog.chainnull.funcitonal;

import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;

public class BasicTestCase extends FunctionalTestCase{

public void testBasic() throws Exception
{
MuleClient client=new MuleClient();
client.dispatch("vm://fromTest", "Hello",null);
MuleMessage msg;


msg=client.request("file://chainnull", 10000);
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertEquals("Hello",msg.getPayloadAsString());

msg=client.request("vm://toTest", 10000);
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertEquals("Hello",msg.getPayloadAsString());


}

@Override
protected String getConfigResources() {
return "chainnull/mule-config.xml";
}

}

As you can see, I am sending a message, then checking that it has been
written to file and then also get a chained response.

Hope this is what you were looking for...

Stephen

iwanek@... wrote:

> Within 3 minutes! Wow! Thanks!
>
> Groovy... now you are pushing me far far out the sea...
>
> I see some examples using <scripting:transformer ...> on the net.
> Is this what you have in mind?
>
> Thanks.
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Monday, October 19, 2009 7:43 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> So, i would typically put the response-transformer inside the endpoint... I
> just prefare it that way ;) shorter...
>
> <file:outbound-endpoint name="fileout" path="/some/dir"
> synchronous="true" response-transformers="mytrans">
>
> Now, if you do not like to write a custom transformer, how about groovy?
>
> Stephen
>
>
>
> iwanek@... wrote:
>  
>> Thank you for the suggestion.
>>
>> But I am not sure what sort of response-transformer to setup.
>> I think it would be something like the following, but don't know which
>> transformer should go in the place of __HERE__?
>>
>> <outbound>
>>   <chaining-router>
>>     <file:outbound-endpoint name="fileout" path="/some/dir"
>> synchronous="true">
>>       <response-transformers>
>>         <__HERE__/>
>>       </response-transformers>
>>     </file:outbound-endpoint>
>>     <vm:outbound-endpoint path="Success"/>
>>   </chaining-router>
>> </outbound>
>>
>> I am not comfortable at all about writing a new custom transformer.
>> I'd very much like to reuse exsiting ones...
>>
>> -----Original Message-----
>> From: Stephen Fenech [mailto:stephen.fenech@...]
>> Sent: Friday, October 16, 2009 7:53 PM
>> To: user@...
>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>
>> Hi,
>>
>> The file transport is not "synchronous". When you try to make a
>> synchronous call, you will get back a null. And then the router will
>> not continue routing. What you could try to do is use a
>> responseTransformer, to change that null into something else... so
>> that chaining router will route that to the next endpoint.
>>
>> Have not tried it myself but i think it should do the trick.
>>
>> Stephen
>>
>> iwanek@... wrote:
>>  
>>    
>>> Following up to my own question.
>>>
>>> When using File transport as my first outbound endpoint and
>>>    
>>>      
>> chaining-router,
>>  
>>    
>>> i.e.,
>>>
>>> <outbound>
>>>     <chaining-router>
>>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>>         <vm:outbound-endpoint path="Success"/>
>>>     </chaining-router>
>>> </outbound>
>>>
>>> Mule gives me warning:
>>>
>>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>>   cannot process any further endpoints. There was no result returned from
>>>   endpoint invocation: ...
>>>
>>> and vm:outbound-endpoint is not fired.
>>>
>>> I think this is because File transport is asynchronous (i.e., does
>>> not return any response back). It does not seem to be able to make
>>> File transport synchronous, so that I can not use chaining-router?
>>>
>>> -----Original Message-----
>>> From: iwanek@... [mailto:iwanek@...]
>>> Sent: Friday, October 16, 2009 12:09 PM
>>> To: user@...
>>> Subject: [mule-user] outbound dispatching on the absence of error
>>>
>>> Hello list,
>>>
>>> Using Mule 2.2.1 CE.
>>>
>>> My use case is as follows:
>>>
>>> - Quartz inbound periodically invokes my component A.
>>> - Component A sends a payload to outbound router.
>>> - Outbound router should:
>>>     - try to send payload to outbound endpoint B,
>>>     - if sending payload to B succeeds, invoke another component C
>>>       via Vm endpoint,
>>>     - if sending payload to B fails, log the error.
>>>
>>> Which router/filter/exception-strategy combination can achive this
>>> outbound dispatching behavior?
>>>
>>> By the way, outbound endpoint B may either be File transport or JMS
>>> transport, if this makes a difference.
>>>
>>> Thanks in advance.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>  
>>>    
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you very very very much! This is exactly what I want.
Clever trick, I should say.

I have one last question, though.

I am not certain about the purpose of
<vm:connector name="vmConnector" queueEvents="true"/>
It seems to work without this global queueEvents property.
Why do I need this? What I am missing?

Thanks.

-----Original Message-----
From: Stephen Fenech [mailto:stephen.fenech@...]
Sent: Monday, October 19, 2009 8:35 PM
To: user@...
Subject: Re: [mule-user] outbound dispatching on the absence of error

So,

I did some testing, so that I make sure that I am not sending you in the
wrong direction, and funnily enough, found a much simpler solution which
I was not expecting. I am using Mule 2.2.1 like you and the following
worked:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
xmlns:script="http://www.mulesource.org/schema/mule/scripting/2.2"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.2
http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/vm/2.2
http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
http://www.mulesource.org/schema/mule/scripting/2.2
http://www.mulesource.org/schema/mule/scripting/2.2/mule-scripting.xsd
http://www.mulesource.org/schema/mule/file/2.2
http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd">

<file:connector name="fileConnector" streaming="false" autoDelete="true"/>
<vm:connector name="vmConnector" queueEvents="true"/>

<model>

<service name="chainingService">
<inbound>
<vm:inbound-endpoint path="fromTest"/>
</inbound>
<log-component/>
<outbound>
<chaining-router>
<vm:outbound-endpoint path="internal"/>
<vm:outbound-endpoint path="toTest"/>
</chaining-router>
</outbound>
</service>

<service name="fileWriter">
<inbound>
<vm:inbound-endpoint path="internal" synchronous="true"/>
</inbound>
<log-component/>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="chainnull"/>
</pass-through-router>
</outbound>
</service>


</model>

</mule>

The trick seems to be to have that extra vm hop in order to use the vm
synchronous behaviour rather than the file. So basically, the following
test was successfull!

package com.ricston.blog.chainnull.funcitonal;

import org.mule.api.MuleMessage;
import org.mule.module.client.MuleClient;
import org.mule.tck.FunctionalTestCase;

public class BasicTestCase extends FunctionalTestCase{

public void testBasic() throws Exception
{
MuleClient client=new MuleClient();
client.dispatch("vm://fromTest", "Hello",null);
MuleMessage msg;


msg=client.request("file://chainnull", 10000);
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertEquals("Hello",msg.getPayloadAsString());

msg=client.request("vm://toTest", 10000);
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertEquals("Hello",msg.getPayloadAsString());


}

@Override
protected String getConfigResources() {
return "chainnull/mule-config.xml";
}

}

As you can see, I am sending a message, then checking that it has been
written to file and then also get a chained response.

Hope this is what you were looking for...

Stephen

iwanek@... wrote:

> Within 3 minutes! Wow! Thanks!
>
> Groovy... now you are pushing me far far out the sea...
>
> I see some examples using <scripting:transformer ...> on the net.
> Is this what you have in mind?
>
> Thanks.
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Monday, October 19, 2009 7:43 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> So, i would typically put the response-transformer inside the endpoint...
I

> just prefare it that way ;) shorter...
>
> <file:outbound-endpoint name="fileout" path="/some/dir"
> synchronous="true" response-transformers="mytrans">
>
> Now, if you do not like to write a custom transformer, how about groovy?
>
> Stephen
>
>
>
> iwanek@... wrote:
>  
>> Thank you for the suggestion.
>>
>> But I am not sure what sort of response-transformer to setup.
>> I think it would be something like the following, but don't know which
>> transformer should go in the place of __HERE__?
>>
>> <outbound>
>>   <chaining-router>
>>     <file:outbound-endpoint name="fileout" path="/some/dir"
>> synchronous="true">
>>       <response-transformers>
>>         <__HERE__/>
>>       </response-transformers>
>>     </file:outbound-endpoint>
>>     <vm:outbound-endpoint path="Success"/>
>>   </chaining-router>
>> </outbound>
>>
>> I am not comfortable at all about writing a new custom transformer.
>> I'd very much like to reuse exsiting ones...
>>
>> -----Original Message-----
>> From: Stephen Fenech [mailto:stephen.fenech@...]
>> Sent: Friday, October 16, 2009 7:53 PM
>> To: user@...
>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>
>> Hi,
>>
>> The file transport is not "synchronous". When you try to make a
>> synchronous call, you will get back a null. And then the router will
>> not continue routing. What you could try to do is use a
>> responseTransformer, to change that null into something else... so
>> that chaining router will route that to the next endpoint.
>>
>> Have not tried it myself but i think it should do the trick.
>>
>> Stephen
>>
>> iwanek@... wrote:
>>  
>>    
>>> Following up to my own question.
>>>
>>> When using File transport as my first outbound endpoint and
>>>    
>>>      
>> chaining-router,
>>  
>>    
>>> i.e.,
>>>
>>> <outbound>
>>>     <chaining-router>
>>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>>         <vm:outbound-endpoint path="Success"/>
>>>     </chaining-router>
>>> </outbound>
>>>
>>> Mule gives me warning:
>>>
>>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>>   cannot process any further endpoints. There was no result returned
from

>>>   endpoint invocation: ...
>>>
>>> and vm:outbound-endpoint is not fired.
>>>
>>> I think this is because File transport is asynchronous (i.e., does
>>> not return any response back). It does not seem to be able to make
>>> File transport synchronous, so that I can not use chaining-router?
>>>
>>> -----Original Message-----
>>> From: iwanek@... [mailto:iwanek@...]
>>> Sent: Friday, October 16, 2009 12:09 PM
>>> To: user@...
>>> Subject: [mule-user] outbound dispatching on the absence of error
>>>
>>> Hello list,
>>>
>>> Using Mule 2.2.1 CE.
>>>
>>> My use case is as follows:
>>>
>>> - Quartz inbound periodically invokes my component A.
>>> - Component A sends a payload to outbound router.
>>> - Outbound router should:
>>>     - try to send payload to outbound endpoint B,
>>>     - if sending payload to B succeeds, invoke another component C
>>>       via Vm endpoint,
>>>     - if sending payload to B fails, log the error.
>>>
>>> Which router/filter/exception-strategy combination can achive this
>>> outbound dispatching behavior?
>>>
>>> By the way, outbound endpoint B may either be File transport or JMS
>>> transport, if this makes a difference.
>>>
>>> Thanks in advance.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>  
>>>    
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: outbound dispatching on the absence of error

by Stephen Fenech-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Technically you do not need the queueEvents="true" for the scenario to work,

I needed it for the test to work... Basically, with queueEvents="true"
you will actually have queus representing the vm paths. Without the
queueEvents="true" the behaviour would only be synchronous. So you wont
be able to do something like client.request("vm://myqueue").

So you do NOT need the queueEvents="true" for this scenario to work :)

Stephen

iwanek@... wrote:

> Thank you very very very much! This is exactly what I want.
> Clever trick, I should say.
>
> I have one last question, though.
>
> I am not certain about the purpose of
> <vm:connector name="vmConnector" queueEvents="true"/>
> It seems to work without this global queueEvents property.
> Why do I need this? What I am missing?
>
> Thanks.
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Monday, October 19, 2009 8:35 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> So,
>
> I did some testing, so that I make sure that I am not sending you in the
> wrong direction, and funnily enough, found a much simpler solution which
> I was not expecting. I am using Mule 2.2.1 like you and the following
> worked:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:spring="http://www.springframework.org/schema/beans"
> xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
> xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
> xmlns:script="http://www.mulesource.org/schema/mule/scripting/2.2"
> xsi:schemaLocation="
> http://www.mulesource.org/schema/mule/core/2.2
> http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
> http://www.mulesource.org/schema/mule/vm/2.2
> http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
> http://www.mulesource.org/schema/mule/scripting/2.2
> http://www.mulesource.org/schema/mule/scripting/2.2/mule-scripting.xsd
> http://www.mulesource.org/schema/mule/file/2.2
> http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd">
>
> <file:connector name="fileConnector" streaming="false" autoDelete="true"/>
> <vm:connector name="vmConnector" queueEvents="true"/>
>
> <model>
>
> <service name="chainingService">
> <inbound>
> <vm:inbound-endpoint path="fromTest"/>
> </inbound>
> <log-component/>
> <outbound>
> <chaining-router>
> <vm:outbound-endpoint path="internal"/>
> <vm:outbound-endpoint path="toTest"/>
> </chaining-router>
> </outbound>
> </service>
>
> <service name="fileWriter">
> <inbound>
> <vm:inbound-endpoint path="internal" synchronous="true"/>
> </inbound>
> <log-component/>
> <outbound>
> <pass-through-router>
> <file:outbound-endpoint path="chainnull"/>
> </pass-through-router>
> </outbound>
> </service>
>
>
> </model>
>
> </mule>
>
> The trick seems to be to have that extra vm hop in order to use the vm
> synchronous behaviour rather than the file. So basically, the following
> test was successfull!
>
> package com.ricston.blog.chainnull.funcitonal;
>
> import org.mule.api.MuleMessage;
> import org.mule.module.client.MuleClient;
> import org.mule.tck.FunctionalTestCase;
>
> public class BasicTestCase extends FunctionalTestCase{
>
> public void testBasic() throws Exception
> {
> MuleClient client=new MuleClient();
> client.dispatch("vm://fromTest", "Hello",null);
> MuleMessage msg;
>
>
> msg=client.request("file://chainnull", 10000);
> assertNotNull(msg);
> assertNotNull(msg.getPayload());
> assertEquals("Hello",msg.getPayloadAsString());
>
> msg=client.request("vm://toTest", 10000);
> assertNotNull(msg);
> assertNotNull(msg.getPayload());
> assertEquals("Hello",msg.getPayloadAsString());
>
>
> }
>
> @Override
> protected String getConfigResources() {
> return "chainnull/mule-config.xml";
> }
>
> }
>
> As you can see, I am sending a message, then checking that it has been
> written to file and then also get a chained response.
>
> Hope this is what you were looking for...
>
> Stephen
>
> iwanek@... wrote:
>  
>> Within 3 minutes! Wow! Thanks!
>>
>> Groovy... now you are pushing me far far out the sea...
>>
>> I see some examples using <scripting:transformer ...> on the net.
>> Is this what you have in mind?
>>
>> Thanks.
>>
>> -----Original Message-----
>> From: Stephen Fenech [mailto:stephen.fenech@...]
>> Sent: Monday, October 19, 2009 7:43 PM
>> To: user@...
>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>
>> So, i would typically put the response-transformer inside the endpoint...
>>    
> I
>  
>> just prefare it that way ;) shorter...
>>
>> <file:outbound-endpoint name="fileout" path="/some/dir"
>> synchronous="true" response-transformers="mytrans">
>>
>> Now, if you do not like to write a custom transformer, how about groovy?
>>
>> Stephen
>>
>>
>>
>> iwanek@... wrote:
>>  
>>    
>>> Thank you for the suggestion.
>>>
>>> But I am not sure what sort of response-transformer to setup.
>>> I think it would be something like the following, but don't know which
>>> transformer should go in the place of __HERE__?
>>>
>>> <outbound>
>>>   <chaining-router>
>>>     <file:outbound-endpoint name="fileout" path="/some/dir"
>>> synchronous="true">
>>>       <response-transformers>
>>>         <__HERE__/>
>>>       </response-transformers>
>>>     </file:outbound-endpoint>
>>>     <vm:outbound-endpoint path="Success"/>
>>>   </chaining-router>
>>> </outbound>
>>>
>>> I am not comfortable at all about writing a new custom transformer.
>>> I'd very much like to reuse exsiting ones...
>>>
>>> -----Original Message-----
>>> From: Stephen Fenech [mailto:stephen.fenech@...]
>>> Sent: Friday, October 16, 2009 7:53 PM
>>> To: user@...
>>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>>
>>> Hi,
>>>
>>> The file transport is not "synchronous". When you try to make a
>>> synchronous call, you will get back a null. And then the router will
>>> not continue routing. What you could try to do is use a
>>> responseTransformer, to change that null into something else... so
>>> that chaining router will route that to the next endpoint.
>>>
>>> Have not tried it myself but i think it should do the trick.
>>>
>>> Stephen
>>>
>>> iwanek@... wrote:
>>>  
>>>    
>>>      
>>>> Following up to my own question.
>>>>
>>>> When using File transport as my first outbound endpoint and
>>>>    
>>>>      
>>>>        
>>> chaining-router,
>>>  
>>>    
>>>      
>>>> i.e.,
>>>>
>>>> <outbound>
>>>>     <chaining-router>
>>>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>>>         <vm:outbound-endpoint path="Success"/>
>>>>     </chaining-router>
>>>> </outbound>
>>>>
>>>> Mule gives me warning:
>>>>
>>>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>>>   cannot process any further endpoints. There was no result returned
>>>>        
> from
>  
>>>>   endpoint invocation: ...
>>>>
>>>> and vm:outbound-endpoint is not fired.
>>>>
>>>> I think this is because File transport is asynchronous (i.e., does
>>>> not return any response back). It does not seem to be able to make
>>>> File transport synchronous, so that I can not use chaining-router?
>>>>
>>>> -----Original Message-----
>>>> From: iwanek@... [mailto:iwanek@...]
>>>> Sent: Friday, October 16, 2009 12:09 PM
>>>> To: user@...
>>>> Subject: [mule-user] outbound dispatching on the absence of error
>>>>
>>>> Hello list,
>>>>
>>>> Using Mule 2.2.1 CE.
>>>>
>>>> My use case is as follows:
>>>>
>>>> - Quartz inbound periodically invokes my component A.
>>>> - Component A sends a payload to outbound router.
>>>> - Outbound router should:
>>>>     - try to send payload to outbound endpoint B,
>>>>     - if sending payload to B succeeds, invoke another component C
>>>>       via Vm endpoint,
>>>>     - if sending payload to B fails, log the error.
>>>>
>>>> Which router/filter/exception-strategy combination can achive this
>>>> outbound dispatching behavior?
>>>>
>>>> By the way, outbound endpoint B may either be File transport or JMS
>>>> transport, if this makes a difference.
>>>>
>>>> Thanks in advance.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>  
>>>>    
>>>>      
>>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>  
>>>    
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: outbound dispatching on the absence of error

by iwanek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello list, it's me again.

With the great help I got from Mr. Fenech, file:outbound-endpoint is now
a (sort of) part of the chaining-router; my payload is written to a file and
then
after-choir component is invoked.

Remaining problem is that even when file:outbound-endpoint raises an
exception (I explicitly removed write-permission on /some/dir), AfterChoir
is still fired. Adding synchronous="true" to file:outbound-endpoint is
allowed
but doesn't change the behavior.

How do I make chaining-router terminate the chain when the first outbound
raises an exception? Any help is greatly appreciated.

My mule-config.xml looks like this:

    <service name="Chainer">
      <inbound>
        <vm:inbound-endpoint path="ChainerVM"/>
      </inbound>
      <outbound>
        <chaining-router>
          <!-- AfterChoir should be fired when FileWriter is exception-free
-->
          <vm:outbound-endpoint path="FileWriterVM"/>
          <vm:outbound-endpoint path="AfterChoirVM"/>
        </chaining-router>
      </outbound>
    </service>

    <service name="FileWriter">
      <inbound>
        <vm:inbound-endpoint path="FileWriterVM" synchronous="true">
          <response-transformers>
            <expression-transformer>
              <!-- AfterChoir will get a string "OK" -->
              <return-argument evaluator="string" expression="OK"/>
            </expression-transformer>
          </response-transformers>
        </vm:inbound-endpoint>
      </inbound>
      <log-component/>
      <outbound>
        <pass-through-router>
          <!-- this might raise an exception... -->
          <file:outbound-endpoint name="fileout" path="/some/dir"/>
        </pass-through-router>
      </outbound>
    </service>

    <service name="AfterChoir">
      <inbound>
        <vm:inbound-endpoint path="AfterChoirVM"/>
      </inbound>
      <outbound>
         <pass-through-router>
           <!-- when fired, "OK" is printed on the console or a log -->
           <stdio:outbound-endpoint name="out" system="OUT"/>
         </pass-through-router>
      </outbound>
    </service>

-----Original Message-----
From: Stephen Fenech [mailto:stephen.fenech@...]
Sent: Tuesday, October 20, 2009 7:25 PM
To: user@...
Subject: Re: [mule-user] outbound dispatching on the absence of error

Technically you do not need the queueEvents="true" for the scenario to work,

I needed it for the test to work... Basically, with queueEvents="true"
you will actually have queus representing the vm paths. Without the
queueEvents="true"
 the behaviour would only be synchronous. So you wont be able to do
something like
client.request("vm://myqueue").

So you do NOT need the queueEvents="true" for this scenario to work :)

Stephen

iwanek@... wrote:

> Thank you very very very much! This is exactly what I want.
> Clever trick, I should say.
>
> I have one last question, though.
>
> I am not certain about the purpose of
> <vm:connector name="vmConnector" queueEvents="true"/> It seems to work
> without this global queueEvents property.
> Why do I need this? What I am missing?
>
> Thanks.
>
> -----Original Message-----
> From: Stephen Fenech [mailto:stephen.fenech@...]
> Sent: Monday, October 19, 2009 8:35 PM
> To: user@...
> Subject: Re: [mule-user] outbound dispatching on the absence of error
>
> So,
>
> I did some testing, so that I make sure that I am not sending you in
> the wrong direction, and funnily enough, found a much simpler solution
> which I was not expecting. I am using Mule 2.2.1 like you and the
> following
> worked:
>
> <?xml version="1.0" encoding="UTF-8"?> <mule
> xmlns="http://www.mulesource.org/schema/mule/core/2.2"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:spring="http://www.springframework.org/schema/beans"
> xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
> xmlns:file="http://www.mulesource.org/schema/mule/file/2.2"
> xmlns:script="http://www.mulesource.org/schema/mule/scripting/2.2"
> xsi:schemaLocation="
> http://www.mulesource.org/schema/mule/core/2.2
> http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
> http://www.mulesource.org/schema/mule/vm/2.2
> http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
> http://www.mulesource.org/schema/mule/scripting/2.2
> http://www.mulesource.org/schema/mule/scripting/2.2/mule-scripting.xsd
> http://www.mulesource.org/schema/mule/file/2.2
> http://www.mulesource.org/schema/mule/file/2.2/mule-file.xsd">
>
> <file:connector name="fileConnector" streaming="false"
> autoDelete="true"/> <vm:connector name="vmConnector"
> queueEvents="true"/>
>
> <model>
>
> <service name="chainingService">
> <inbound>
> <vm:inbound-endpoint path="fromTest"/> </inbound> <log-component/>
> <outbound> <chaining-router> <vm:outbound-endpoint path="internal"/>
> <vm:outbound-endpoint path="toTest"/> </chaining-router> </outbound>
> </service>
>
> <service name="fileWriter">
> <inbound>
> <vm:inbound-endpoint path="internal" synchronous="true"/> </inbound>
> <log-component/> <outbound> <pass-through-router>
> <file:outbound-endpoint path="chainnull"/> </pass-through-router>
> </outbound> </service>
>
>
> </model>
>
> </mule>
>
> The trick seems to be to have that extra vm hop in order to use the vm
> synchronous behaviour rather than the file. So basically, the
> following test was successfull!
>
> package com.ricston.blog.chainnull.funcitonal;
>
> import org.mule.api.MuleMessage;
> import org.mule.module.client.MuleClient;
> import org.mule.tck.FunctionalTestCase;
>
> public class BasicTestCase extends FunctionalTestCase{
>
> public void testBasic() throws Exception { MuleClient client=new
> MuleClient(); client.dispatch("vm://fromTest", "Hello",null);
> MuleMessage msg;
>
>
> msg=client.request("file://chainnull", 10000);
> assertNotNull(msg);
> assertNotNull(msg.getPayload());
> assertEquals("Hello",msg.getPayloadAsString());
>
> msg=client.request("vm://toTest", 10000);
> assertNotNull(msg);
> assertNotNull(msg.getPayload());
> assertEquals("Hello",msg.getPayloadAsString());
>
>
> }
>
> @Override
> protected String getConfigResources() {
> return "chainnull/mule-config.xml";
> }
>
> }
>
> As you can see, I am sending a message, then checking that it has been
> written to file and then also get a chained response.
>
> Hope this is what you were looking for...
>
> Stephen
>
> iwanek@... wrote:
>  
>> Within 3 minutes! Wow! Thanks!
>>
>> Groovy... now you are pushing me far far out the sea...
>>
>> I see some examples using <scripting:transformer ...> on the net.
>> Is this what you have in mind?
>>
>> Thanks.
>>
>> -----Original Message-----
>> From: Stephen Fenech [mailto:stephen.fenech@...]
>> Sent: Monday, October 19, 2009 7:43 PM
>> To: user@...
>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>
>> So, i would typically put the response-transformer inside the endpoint...
>>    
> I
>  
>> just prefare it that way ;) shorter...
>>
>> <file:outbound-endpoint name="fileout" path="/some/dir"
>> synchronous="true" response-transformers="mytrans">
>>
>> Now, if you do not like to write a custom transformer, how about groovy?
>>
>> Stephen
>>
>>
>>
>> iwanek@... wrote:
>>  
>>    
>>> Thank you for the suggestion.
>>>
>>> But I am not sure what sort of response-transformer to setup.
>>> I think it would be something like the following, but don't know which
>>> transformer should go in the place of __HERE__?
>>>
>>> <outbound>
>>>   <chaining-router>
>>>     <file:outbound-endpoint name="fileout" path="/some/dir"
>>> synchronous="true">
>>>       <response-transformers>
>>>         <__HERE__/>
>>>       </response-transformers>
>>>     </file:outbound-endpoint>
>>>     <vm:outbound-endpoint path="Success"/>
>>>   </chaining-router>
>>> </outbound>
>>>
>>> I am not comfortable at all about writing a new custom transformer.
>>> I'd very much like to reuse exsiting ones...
>>>
>>> -----Original Message-----
>>> From: Stephen Fenech [mailto:stephen.fenech@...]
>>> Sent: Friday, October 16, 2009 7:53 PM
>>> To: user@...
>>> Subject: Re: [mule-user] outbound dispatching on the absence of error
>>>
>>> Hi,
>>>
>>> The file transport is not "synchronous". When you try to make a
>>> synchronous call, you will get back a null. And then the router will
>>> not continue routing. What you could try to do is use a
>>> responseTransformer, to change that null into something else... so
>>> that chaining router will route that to the next endpoint.
>>>
>>> Have not tried it myself but i think it should do the trick.
>>>
>>> Stephen
>>>
>>> iwanek@... wrote:
>>>  
>>>    
>>>      
>>>> Following up to my own question.
>>>>
>>>> When using File transport as my first outbound endpoint and
>>>>    
>>>>      
>>>>        
>>> chaining-router,
>>>  
>>>    
>>>      
>>>> i.e.,
>>>>
>>>> <outbound>
>>>>     <chaining-router>
>>>>         <file:outbound-endpoint name="fileout" path="/some/dir" />
>>>>         <vm:outbound-endpoint path="Success"/>
>>>>     </chaining-router>
>>>> </outbound>
>>>>
>>>> Mule gives me warning:
>>>>
>>>>   [myService] org.mule.routing.outbound.ChainingRouter: Chaining router
>>>>   cannot process any further endpoints. There was no result returned
>>>>        
> from
>  
>>>>   endpoint invocation: ...
>>>>
>>>> and vm:outbound-endpoint is not fired.
>>>>
>>>> I think this is because File transport is asynchronous (i.e., does
>>>> not return any response back). It does not seem to be able to make
>>>> File transport synchronous, so that I can not use chaining-router?
>>>>
>>>> -----Original Message-----
>>>> From: iwanek@... [mailto:iwanek@...]
>>>> Sent: Friday, October 16, 2009 12:09 PM
>>>> To: user@...
>>>> Subject: [mule-user] outbound dispatching on the absence of error
>>>>
>>>> Hello list,
>>>>
>>>> Using Mule 2.2.1 CE.
>>>>
>>>> My use case is as follows:
>>>>
>>>> - Quartz inbound periodically invokes my component A.
>>>> - Component A sends a payload to outbound router.
>>>> - Outbound router should:
>>>>     - try to send payload to outbound endpoint B,
>>>>     - if sending payload to B succeeds, invoke another component C
>>>>       via Vm endpoint,
>>>>     - if sending payload to B fails, log the error.
>>>>
>>>> Which router/filter/exception-strategy combination can achive this
>>>> outbound dispatching behavior?
>>>>
>>>> By the way, outbound endpoint B may either be File transport or JMS
>>>> transport, if this makes a difference.
>>>>
>>>> Thanks in advance.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>  
>>>>    
>>>>      
>>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>  
>>>    
>>>      
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>  
>>    
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>  


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email