You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pratham <pr...@gmail.com> on 2015/11/05 17:04:14 UTC

Using camel-jetty options in recipient List

Hi , 

i am using camel spring xml for defining routes . The options i am
interested are  camel-jetty <http://camel.apache.org/jetty.html>   options.I
am finding it difficult to understand what is going on in the scenario i am
describing below:

I have a sub-route which will be called from another route for sending
certain notifications to an external url(this is sort of callback to an
application). 

I have a python script running that will start a server listening on port
say 10001. So i can send POST requests to this url i.e
http://localhost:10001/callback.

So when this route is called , recipientList is used as shown below:

<route id="sendCallback" xmlns="....">
    <from uri="direct:callbackRoute"/>
    <! -- other processing here !-->
    <recipientList>
        <simple>jetty:http://localhost:10001/callback</simple>
    </recipientList>
</route>


This works fine , and the required notification is send to the url :
http://localhost:10001/callback and i can see the request hitting the
server. 

Now since this is a jetty endpoint can the options available for camel-jetty
components be used here? I am confused since http://localhost:10001/callback
is just a url/rest endpoint . So does it make sense to consider it a jetty
endpoint( is it producer endpoint?) . 

The url above should simply be : http://localhost:10001/callback an not a
jetty endpoint. The above is not my own code but code i am maintaining so i
am trying to understand what is going on here.

Now if the options listed in  http://camel.apache.org/jetty.html
<http://camel.apache.org/jetty.html>   are used the behavior is not clear.

If an option like enableJmx and few others are used as shown belowthen it
works fine and the request is sent to the url :
http://localhost:10001/callback  , ignoring ?enableJmx=false.

       
<simple>jetty:http://localhost:10001/callback?enableJmx=false</simple>

However if chunked=false is used:
       
<simple>jetty:http://localhost:10001/callback?enableJmx=false</simple>

Then it tries to send to http://localhost:10001/callback?enableJmx=false
which fails since this is now a GET request and i get 404 error.

The option i was looking for was 'chunked' option to disable chunking. I am
thinking that the 'chunked'
option can be used only for a consumer endpoint. Is my understanding correct
?

are the options like chunked only to be used for a Consumer endpoint as
shown below:

   <from
uri="jetty:http://0.0.0.0:8399/test2?matchOnUriPrefix=true&amp;chunked=false"/>


My Apologies for the lengthy description .

Thanks for your help ,
Pratham






--
View this message in context: http://camel.465427.n5.nabble.com/Using-camel-jetty-options-in-recipient-List-tp5773399.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using camel-jetty options in recipient List

Posted by pratham <pr...@gmail.com>.
Hi Claus ,

According to what you said , there are 2 tables :

"options"  - this can be configured in the uri 
"component options" - for jetty endpoint

i did not get what you meant by "enableJmx is on the component only" .
Infact enableJmx option appears in both the tables.

Now , 'chunked' appears in the options table . That means this can be
configured in the endpoint uri. It works when specified in <from> tag as
shown below:

/<route trace="true" id="SimpleProxy">
			<from
uri="jetty:http://0.0.0.0:8299/test2?matchOnUriPrefix=true&amp;chunked=false"
/>
			<to uri="http://0.gravatar.com/avatar?bridgeEndpoint=true" />
</route>/

My understanding is jetty will start a process to listening on port 8299
(this being a consumer(server) endpoint). So when we set 'chunked' to false
and access http://0.0.0.0:8299 in browser , the response headers contain
'content length' header. and on setting chunked to true the response header
will content 'transfer encoding' header instead of content length. This
behavior is clear to me.

However if i have a snippet like below:
/
    <recipientList>
        <simple>jetty:http://localhost:10001/callback?chunked=false</simple>
    </recipientList>/

or :
<to uri="jetty:http://localhost:10001/callback?chunked=false"/>

Is the use of 'chunked' or 'enableJmx' in the uri's above incorrect ?. Both
are listed under options table which can be configured in the endpoint uri.

Thanks




--
View this message in context: http://camel.465427.n5.nabble.com/Using-camel-jetty-options-in-recipient-List-tp5773399p5774627.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using camel-jetty options in recipient List

Posted by Claus Ibsen <cl...@gmail.com>.
The camel-jetty component can do both being a server (consumer) and a
client (producer).

The options on that page is listed in 2 tables. Some options for the
jetty component, and others for the endpoint. Its only the latter you
can configure in the endpoint uri.

So enableJmx is on the component only.


On Thu, Nov 5, 2015 at 5:04 PM, pratham <pr...@gmail.com> wrote:
> Hi ,
>
> i am using camel spring xml for defining routes . The options i am
> interested are  camel-jetty <http://camel.apache.org/jetty.html>   options.I
> am finding it difficult to understand what is going on in the scenario i am
> describing below:
>
> I have a sub-route which will be called from another route for sending
> certain notifications to an external url(this is sort of callback to an
> application).
>
> I have a python script running that will start a server listening on port
> say 10001. So i can send POST requests to this url i.e
> http://localhost:10001/callback.
>
> So when this route is called , recipientList is used as shown below:
>
> <route id="sendCallback" xmlns="....">
>     <from uri="direct:callbackRoute"/>
>     <! -- other processing here !-->
>     <recipientList>
>         <simple>jetty:http://localhost:10001/callback</simple>
>     </recipientList>
> </route>
>
>
> This works fine , and the required notification is send to the url :
> http://localhost:10001/callback and i can see the request hitting the
> server.
>
> Now since this is a jetty endpoint can the options available for camel-jetty
> components be used here? I am confused since http://localhost:10001/callback
> is just a url/rest endpoint . So does it make sense to consider it a jetty
> endpoint( is it producer endpoint?) .
>
> The url above should simply be : http://localhost:10001/callback an not a
> jetty endpoint. The above is not my own code but code i am maintaining so i
> am trying to understand what is going on here.
>
> Now if the options listed in  http://camel.apache.org/jetty.html
> <http://camel.apache.org/jetty.html>   are used the behavior is not clear.
>
> If an option like enableJmx and few others are used as shown belowthen it
> works fine and the request is sent to the url :
> http://localhost:10001/callback  , ignoring ?enableJmx=false.
>
>
> <simple>jetty:http://localhost:10001/callback?enableJmx=false</simple>
>
> However if chunked=false is used:
>
> <simple>jetty:http://localhost:10001/callback?enableJmx=false</simple>
>
> Then it tries to send to http://localhost:10001/callback?enableJmx=false
> which fails since this is now a GET request and i get 404 error.
>
> The option i was looking for was 'chunked' option to disable chunking. I am
> thinking that the 'chunked'
> option can be used only for a consumer endpoint. Is my understanding correct
> ?
>
> are the options like chunked only to be used for a Consumer endpoint as
> shown below:
>
>    <from
> uri="jetty:http://0.0.0.0:8399/test2?matchOnUriPrefix=true&amp;chunked=false"/>
>
>
> My Apologies for the lengthy description .
>
> Thanks for your help ,
> Pratham
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-camel-jetty-options-in-recipient-List-tp5773399.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2