You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by KRIANGYUT WANGJITMAN <KR...@set.or.th> on 2010/08/03 12:59:10 UTC

config MessageInjector to call a http proxy

I created a http proxy with url
http://localhost:8280/services/proxy.proxyHttpEndpoint.

This proxy does some tasks and don't return any result.

I can curl the url from my command line and all tasks are done
correctly.

 

I have to call this proxy repeatly so I decided to use the
MessageInjector to call my proxy.

The task's configuration is:

    <task name="BSBD_STT_FileTransfer_Task"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">

        <trigger cron="*/10 * * ? * *"/>

        <property
xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="format" value="get"/>

        <property
xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="to"
value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>

        <property
xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="message">

            <getFile/>

        </property>

</task>

 

After submit the task. My main sequence is called instread of the proxy.

 

This proxy requires no input. I first try not to set message property
but an error, "no message set", is thrown.

 

Why the main sequence is called?

What configuration must change then the proxy is called?

 

Thank you

Kriangyut


Re: config MessageInjector to call a http proxy

Posted by Ruwan Linton <ru...@gmail.com>.
+1, make it a task by wrapping it with an implementation of the Task
interface.

Ruwan

On Wed, Aug 4, 2010 at 10:16 AM, KRIANGYUT WANGJITMAN
<KR...@set.or.th>wrote:

> I've try the first already and it works well.
> As you said it's quite dirty so I use a wsdl2java tool to create a ws
> stub.
> I think this way may work and clean.
>
> Kriangyut
>
>
> -----Original Message-----
> From: Ruwan Linton [mailto:ruwan.linton@gmail.com]
> Sent: Wednesday, August 04, 2010 11:39 AM
> To: user@synapse.apache.org
> Subject: Re: config MessageInjector to call a http proxy
>
> No problem at all, hope you got the first approach working.
>
> Ruwan
>
> On Wed, Aug 4, 2010 at 9:57 AM, KRIANGYUT WANGJITMAN
> <KR...@set.or.th>wrote:
>
> > Thank you very much Ruwan to correct my mis-understanding.
> >
> > -----Original Message-----
> > From: Ruwan Linton [mailto:ruwan.linton@gmail.com]
> > Sent: Wednesday, August 04, 2010 10:54 AM
> > To: user@synapse.apache.org
> > Subject: Re: config MessageInjector to call a http proxy
> >
> > Hi Kriangyut,
> >
> > The MessageInjector is a specific task shipped with Synapse to inject
> a
> > message into the Synapse main sequence, so the behavior you saw is
> > correct.
> >
> > To achieve your requirement there are 2 options,
> > 1) Add a send mediator to the main sequence with specifying the proxy
> > URL as
> > the endpoint address; which is is easy but dirty way of getting it to
> > work.
> > 2) You could write your own task implementation to inject a message
> into
> > a
> > proxy and schedule that using the tasks. What you need to do is to
> > implement
> > something like MessageInjector; which is going to be a bit difficult
> but
> > clean.
> >
> > So as the first try you could try 1 and try to get it to work.
> >
> > Thanks,
> > Ruwan
> >
> > On Tue, Aug 3, 2010 at 4:29 PM, KRIANGYUT WANGJITMAN
> > <KR...@set.or.th>wrote:
> >
> > > I created a http proxy with url
> > > http://localhost:8280/services/proxy.proxyHttpEndpoint.
> > >
> > > This proxy does some tasks and don't return any result.
> > >
> > > I can curl the url from my command line and all tasks are done
> > > correctly.
> > >
> > >
> > >
> > > I have to call this proxy repeatly so I decided to use the
> > > MessageInjector to call my proxy.
> > >
> > > The task's configuration is:
> > >
> > >    <task name="BSBD_STT_FileTransfer_Task"
> > > class="org.apache.synapse.startup.tasks.MessageInjector"
> > > group="synapse.simple.quartz">
> > >
> > >        <trigger cron="*/10 * * ? * *"/>
> > >
> > >        <property
> > > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > > name="format" value="get"/>
> > >
> > >        <property
> > > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> name="to"
> > > value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>
> > >
> > >        <property
> > > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > > name="message">
> > >
> > >            <getFile/>
> > >
> > >        </property>
> > >
> > > </task>
> > >
> > >
> > >
> > > After submit the task. My main sequence is called instread of the
> > proxy.
> > >
> > >
> > >
> > > This proxy requires no input. I first try not to set message
> property
> > > but an error, "no message set", is thrown.
> > >
> > >
> > >
> > > Why the main sequence is called?
> > >
> > > What configuration must change then the proxy is called?
> > >
> > >
> > >
> > > Thank you
> > >
> > > Kriangyut
> > >
> > >
> >
> >
> > --
> > Ruwan Linton
> > Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> > WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
> >
> > Lean . Enterprise . Middleware
> >
> > phone: +1 408 754 7388 ext 51789
> > email: ruwan@wso2.com; cell: +94 77 341 3097
> > blog: http://blog.ruwan.org
> > linkedin: http://www.linkedin.com/in/ruwanlinton
> > google: http://www.google.com/profiles/ruwan.linton
> > tweet: http://twitter.com/ruwanlinton
> >
>
>
>
> --
> Ruwan Linton
> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
>
> Lean . Enterprise . Middleware
>
> phone: +1 408 754 7388 ext 51789
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> google: http://www.google.com/profiles/ruwan.linton
> tweet: http://twitter.com/ruwanlinton
>



-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

RE: config MessageInjector to call a http proxy

Posted by KRIANGYUT WANGJITMAN <KR...@set.or.th>.
I've try the first already and it works well.
As you said it's quite dirty so I use a wsdl2java tool to create a ws
stub.
I think this way may work and clean.

Kriangyut


-----Original Message-----
From: Ruwan Linton [mailto:ruwan.linton@gmail.com] 
Sent: Wednesday, August 04, 2010 11:39 AM
To: user@synapse.apache.org
Subject: Re: config MessageInjector to call a http proxy

No problem at all, hope you got the first approach working.

Ruwan

On Wed, Aug 4, 2010 at 9:57 AM, KRIANGYUT WANGJITMAN
<KR...@set.or.th>wrote:

> Thank you very much Ruwan to correct my mis-understanding.
>
> -----Original Message-----
> From: Ruwan Linton [mailto:ruwan.linton@gmail.com]
> Sent: Wednesday, August 04, 2010 10:54 AM
> To: user@synapse.apache.org
> Subject: Re: config MessageInjector to call a http proxy
>
> Hi Kriangyut,
>
> The MessageInjector is a specific task shipped with Synapse to inject
a
> message into the Synapse main sequence, so the behavior you saw is
> correct.
>
> To achieve your requirement there are 2 options,
> 1) Add a send mediator to the main sequence with specifying the proxy
> URL as
> the endpoint address; which is is easy but dirty way of getting it to
> work.
> 2) You could write your own task implementation to inject a message
into
> a
> proxy and schedule that using the tasks. What you need to do is to
> implement
> something like MessageInjector; which is going to be a bit difficult
but
> clean.
>
> So as the first try you could try 1 and try to get it to work.
>
> Thanks,
> Ruwan
>
> On Tue, Aug 3, 2010 at 4:29 PM, KRIANGYUT WANGJITMAN
> <KR...@set.or.th>wrote:
>
> > I created a http proxy with url
> > http://localhost:8280/services/proxy.proxyHttpEndpoint.
> >
> > This proxy does some tasks and don't return any result.
> >
> > I can curl the url from my command line and all tasks are done
> > correctly.
> >
> >
> >
> > I have to call this proxy repeatly so I decided to use the
> > MessageInjector to call my proxy.
> >
> > The task's configuration is:
> >
> >    <task name="BSBD_STT_FileTransfer_Task"
> > class="org.apache.synapse.startup.tasks.MessageInjector"
> > group="synapse.simple.quartz">
> >
> >        <trigger cron="*/10 * * ? * *"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > name="format" value="get"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="to"
> > value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > name="message">
> >
> >            <getFile/>
> >
> >        </property>
> >
> > </task>
> >
> >
> >
> > After submit the task. My main sequence is called instread of the
> proxy.
> >
> >
> >
> > This proxy requires no input. I first try not to set message
property
> > but an error, "no message set", is thrown.
> >
> >
> >
> > Why the main sequence is called?
> >
> > What configuration must change then the proxy is called?
> >
> >
> >
> > Thank you
> >
> > Kriangyut
> >
> >
>
>
> --
> Ruwan Linton
> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
>
> Lean . Enterprise . Middleware
>
> phone: +1 408 754 7388 ext 51789
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> google: http://www.google.com/profiles/ruwan.linton
> tweet: http://twitter.com/ruwanlinton
>



-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

Re: config MessageInjector to call a http proxy

Posted by Ruwan Linton <ru...@gmail.com>.
No problem at all, hope you got the first approach working.

Ruwan

On Wed, Aug 4, 2010 at 9:57 AM, KRIANGYUT WANGJITMAN <KR...@set.or.th>wrote:

> Thank you very much Ruwan to correct my mis-understanding.
>
> -----Original Message-----
> From: Ruwan Linton [mailto:ruwan.linton@gmail.com]
> Sent: Wednesday, August 04, 2010 10:54 AM
> To: user@synapse.apache.org
> Subject: Re: config MessageInjector to call a http proxy
>
> Hi Kriangyut,
>
> The MessageInjector is a specific task shipped with Synapse to inject a
> message into the Synapse main sequence, so the behavior you saw is
> correct.
>
> To achieve your requirement there are 2 options,
> 1) Add a send mediator to the main sequence with specifying the proxy
> URL as
> the endpoint address; which is is easy but dirty way of getting it to
> work.
> 2) You could write your own task implementation to inject a message into
> a
> proxy and schedule that using the tasks. What you need to do is to
> implement
> something like MessageInjector; which is going to be a bit difficult but
> clean.
>
> So as the first try you could try 1 and try to get it to work.
>
> Thanks,
> Ruwan
>
> On Tue, Aug 3, 2010 at 4:29 PM, KRIANGYUT WANGJITMAN
> <KR...@set.or.th>wrote:
>
> > I created a http proxy with url
> > http://localhost:8280/services/proxy.proxyHttpEndpoint.
> >
> > This proxy does some tasks and don't return any result.
> >
> > I can curl the url from my command line and all tasks are done
> > correctly.
> >
> >
> >
> > I have to call this proxy repeatly so I decided to use the
> > MessageInjector to call my proxy.
> >
> > The task's configuration is:
> >
> >    <task name="BSBD_STT_FileTransfer_Task"
> > class="org.apache.synapse.startup.tasks.MessageInjector"
> > group="synapse.simple.quartz">
> >
> >        <trigger cron="*/10 * * ? * *"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > name="format" value="get"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="to"
> > value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>
> >
> >        <property
> > xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> > name="message">
> >
> >            <getFile/>
> >
> >        </property>
> >
> > </task>
> >
> >
> >
> > After submit the task. My main sequence is called instread of the
> proxy.
> >
> >
> >
> > This proxy requires no input. I first try not to set message property
> > but an error, "no message set", is thrown.
> >
> >
> >
> > Why the main sequence is called?
> >
> > What configuration must change then the proxy is called?
> >
> >
> >
> > Thank you
> >
> > Kriangyut
> >
> >
>
>
> --
> Ruwan Linton
> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> WSO2 <http://wso2.org/esb%0AWSO2> Inc.; http://wso2.org
>
> Lean . Enterprise . Middleware
>
> phone: +1 408 754 7388 ext 51789
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> google: http://www.google.com/profiles/ruwan.linton
> tweet: http://twitter.com/ruwanlinton
>



-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

RE: config MessageInjector to call a http proxy

Posted by KRIANGYUT WANGJITMAN <KR...@set.or.th>.
Thank you very much Ruwan to correct my mis-understanding.

-----Original Message-----
From: Ruwan Linton [mailto:ruwan.linton@gmail.com] 
Sent: Wednesday, August 04, 2010 10:54 AM
To: user@synapse.apache.org
Subject: Re: config MessageInjector to call a http proxy

Hi Kriangyut,

The MessageInjector is a specific task shipped with Synapse to inject a
message into the Synapse main sequence, so the behavior you saw is
correct.

To achieve your requirement there are 2 options,
1) Add a send mediator to the main sequence with specifying the proxy
URL as
the endpoint address; which is is easy but dirty way of getting it to
work.
2) You could write your own task implementation to inject a message into
a
proxy and schedule that using the tasks. What you need to do is to
implement
something like MessageInjector; which is going to be a bit difficult but
clean.

So as the first try you could try 1 and try to get it to work.

Thanks,
Ruwan

On Tue, Aug 3, 2010 at 4:29 PM, KRIANGYUT WANGJITMAN
<KR...@set.or.th>wrote:

> I created a http proxy with url
> http://localhost:8280/services/proxy.proxyHttpEndpoint.
>
> This proxy does some tasks and don't return any result.
>
> I can curl the url from my command line and all tasks are done
> correctly.
>
>
>
> I have to call this proxy repeatly so I decided to use the
> MessageInjector to call my proxy.
>
> The task's configuration is:
>
>    <task name="BSBD_STT_FileTransfer_Task"
> class="org.apache.synapse.startup.tasks.MessageInjector"
> group="synapse.simple.quartz">
>
>        <trigger cron="*/10 * * ? * *"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> name="format" value="get"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="to"
> value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> name="message">
>
>            <getFile/>
>
>        </property>
>
> </task>
>
>
>
> After submit the task. My main sequence is called instread of the
proxy.
>
>
>
> This proxy requires no input. I first try not to set message property
> but an error, "no message set", is thrown.
>
>
>
> Why the main sequence is called?
>
> What configuration must change then the proxy is called?
>
>
>
> Thank you
>
> Kriangyut
>
>


-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

Re: config MessageInjector to call a http proxy

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Kriangyut,

The MessageInjector is a specific task shipped with Synapse to inject a
message into the Synapse main sequence, so the behavior you saw is correct.

To achieve your requirement there are 2 options,
1) Add a send mediator to the main sequence with specifying the proxy URL as
the endpoint address; which is is easy but dirty way of getting it to work.
2) You could write your own task implementation to inject a message into a
proxy and schedule that using the tasks. What you need to do is to implement
something like MessageInjector; which is going to be a bit difficult but
clean.

So as the first try you could try 1 and try to get it to work.

Thanks,
Ruwan

On Tue, Aug 3, 2010 at 4:29 PM, KRIANGYUT WANGJITMAN <KR...@set.or.th>wrote:

> I created a http proxy with url
> http://localhost:8280/services/proxy.proxyHttpEndpoint.
>
> This proxy does some tasks and don't return any result.
>
> I can curl the url from my command line and all tasks are done
> correctly.
>
>
>
> I have to call this proxy repeatly so I decided to use the
> MessageInjector to call my proxy.
>
> The task's configuration is:
>
>    <task name="BSBD_STT_FileTransfer_Task"
> class="org.apache.synapse.startup.tasks.MessageInjector"
> group="synapse.simple.quartz">
>
>        <trigger cron="*/10 * * ? * *"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> name="format" value="get"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="to"
> value="http://localhost:8280/services/proxy.proxyHttpEndpoint"/>
>
>        <property
> xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
> name="message">
>
>            <getFile/>
>
>        </property>
>
> </task>
>
>
>
> After submit the task. My main sequence is called instread of the proxy.
>
>
>
> This proxy requires no input. I first try not to set message property
> but an error, "no message set", is thrown.
>
>
>
> Why the main sequence is called?
>
> What configuration must change then the proxy is called?
>
>
>
> Thank you
>
> Kriangyut
>
>


-- 
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org

Lean . Enterprise . Middleware

phone: +1 408 754 7388 ext 51789
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton