FAQ
Hi,

I have a question regarding camel mina concerning sending different messages
in one session.

I would like to send out different messages, afaik you can configure camel
to saend a message via

from("messagesource").to("tcp://localhost:port?options");

What if i want to send three different messages and not only one?
For example i would need to send the following messages in one session

/******* Message 1 *******************/
// ESTABLISH SESSION
ESTABLISHSSESSIONMESSAGES
//GET RESPONSE
GETRESPONSE

/******* Message 2 *******************/
//SENDAUTHENTICATION
SENDAUTHENTICATIONMESSAGE
//GETRESPONSE
GETAUTHENTICATION RESPONSE

/******* Message 3 *******************/
//SENDACTUAL MESSAGE
ACTUALMESSAGE
//RECEIVE RESPONSE
RECEIVE ACTUAL RESPONSDE

I can send these as three separate message using a camel producer
.requestbody
However the three messages need to be authenticated in order for it to be
used.

Is there anyway that i can do this through camel?

Does camel mina pool connections or does it connect-disconnect?

thanks
carlo

Search Discussions

  • Claus Ibsen at Mar 2, 2010 at 3:44 pm
    Hi

    camel-mina pool the producers so if the session is still alive it will
    be send within the same session.
    If not it will reconnect.

    There is an option to force the session to be closed right after use,
    which obviously is not what you want.
    But other people prefer that.

    On Tue, Mar 2, 2010 at 3:29 PM, Carlo Camerino wrote:
    Hi,

    I have a question regarding camel mina concerning sending different messages
    in one session.

    I would like to send out different messages, afaik you can configure camel
    to saend a message via

    from("messagesource").to("tcp://localhost:port?options");

    What if i want to send three different messages and not only one?
    For example i would need to send the following messages in one session

    /******* Message 1 *******************/
    // ESTABLISH SESSION
    ESTABLISHSSESSIONMESSAGES
    //GET RESPONSE
    GETRESPONSE

    /******* Message 2 *******************/
    //SENDAUTHENTICATION
    SENDAUTHENTICATIONMESSAGE
    //GETRESPONSE
    GETAUTHENTICATION RESPONSE

    /******* Message 3 *******************/
    //SENDACTUAL MESSAGE
    ACTUALMESSAGE
    //RECEIVE RESPONSE
    RECEIVE ACTUAL RESPONSDE

    I can send these as three separate message using a camel producer
    .requestbody
    However the three messages need to be authenticated in order for it to be
    used.

    Is there anyway that i can do this through camel?

    Does camel mina pool connections or does it connect-disconnect?

    thanks
    carlo


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Carlo Camerino at Mar 2, 2010 at 7:01 pm
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
  • Anandsk at Mar 2, 2010 at 9:04 pm
    If I understand your question correctly, you may want to look at codec option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Carlo Camerino at Mar 3, 2010 at 3:59 pm
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Anandsk at Mar 3, 2010 at 6:20 pm
    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Carlo Camerino at Mar 3, 2010 at 6:32 pm
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Claus Ibsen at Mar 3, 2010 at 6:37 pm
    There is no correlation with Mina 1.x. Its very low level and you
    gotta deal with that yourself.

    Its my hope that Mina 2.0 or Netty has some sort of build in support
    for correlation in its core.
    But you gotta look at that yourself, so read the Mina or Netty documentation.

    On Wed, Mar 3, 2010 at 7:31 PM, Carlo Camerino wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Carlo Camerino at Mar 3, 2010 at 6:39 pm
    will camel-mina support mina 2.0?
    i think it has support for request reply
    On Thu, Mar 4, 2010 at 2:36 AM, Claus Ibsen wrote:
    There is no correlation with Mina 1.x. Its very low level and you
    gotta deal with that yourself.

    Its my hope that Mina 2.0 or Netty has some sort of build in support
    for correlation in its core.
    But you gotta look at that yourself, so read the Mina or Netty documentation.

    On Wed, Mar 3, 2010 at 7:31 PM, Carlo Camerino wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Claus Ibsen at Mar 3, 2010 at 6:41 pm

    On Wed, Mar 3, 2010 at 7:39 PM, Carlo Camerino wrote:
    will camel-mina support mina 2.0?
    i think it has support for request reply
    Mina 2.0 is not GA yet. They are still working on it, although it
    appears to take a very very long time for them to get it done and
    released.


    On Thu, Mar 4, 2010 at 2:36 AM, Claus Ibsen wrote:
    There is no correlation with Mina 1.x. Its very low level and you
    gotta deal with that yourself.

    Its my hope that Mina 2.0 or Netty has some sort of build in support
    for correlation in its core.
    But you gotta look at that yourself, so read the Mina or Netty documentation.

    On Wed, Mar 3, 2010 at 7:31 PM, Carlo Camerino wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Carlo Camerino at Mar 3, 2010 at 6:51 pm
    hmm,,

    will i have problems i use normal java Sockets instead and java.io?

    Is there a camel component for this?
    On Thu, Mar 4, 2010 at 2:40 AM, Claus Ibsen wrote:
    On Wed, Mar 3, 2010 at 7:39 PM, Carlo Camerino wrote:
    will camel-mina support mina 2.0?
    i think it has support for request reply
    Mina 2.0 is not GA yet. They are still working on it, although it
    appears to take a very very long time for them to get it done and
    released.


    On Thu, Mar 4, 2010 at 2:36 AM, Claus Ibsen wrote:
    There is no correlation with Mina 1.x. Its very low level and you
    gotta deal with that yourself.

    Its my hope that Mina 2.0 or Netty has some sort of build in support
    for correlation in its core.
    But you gotta look at that yourself, so read the Mina or Netty documentation.

    On Wed, Mar 3, 2010 at 7:31 PM, Carlo Camerino wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus


    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Willem Jiang at Mar 4, 2010 at 12:34 am
    Hi,

    I don't think there is a raw java Socket camel component for it.
    But it should be easy for you to write a customer camel component.
    Please check these document out
    [1] http://camel.apache.org/writing-components.html
    [2] http://camel.apache.org/how-do-i-add-a-component.html

    Willem

    Carlo Camerino wrote:
    hmm,,

    will i have problems i use normal java Sockets instead and java.io?

    Is there a camel component for this?
    On Thu, Mar 4, 2010 at 2:40 AM, Claus Ibsen wrote:
    On Wed, Mar 3, 2010 at 7:39 PM, Carlo Camerino wrote:
    will camel-mina support mina 2.0?
    i think it has support for request reply
    Mina 2.0 is not GA yet. They are still working on it, although it
    appears to take a very very long time for them to get it done and
    released.


    On Thu, Mar 4, 2010 at 2:36 AM, Claus Ibsen wrote:
    There is no correlation with Mina 1.x. Its very low level and you
    gotta deal with that yourself.

    Its my hope that Mina 2.0 or Netty has some sort of build in support
    for correlation in its core.
    But you gotta look at that yourself, so read the Mina or Netty documentation.

    On Wed, Mar 3, 2010 at 7:31 PM, Carlo Camerino wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:
    when you use from it becomes the consumer and listens on that port if your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely. other
    alternative is using synchronus request/reply by setting sync flag to true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:
    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.

    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus

    --
    Claus Ibsen
    Apache Camel Committer

    Author of Camel in Action: http://www.manning.com/ibsen/
    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Anandsk at Mar 3, 2010 at 9:13 pm
    if your question is not answered yet, please post your route.

    carlo c wrote:
    i used sync =true, i'm still got replies from another thread....
    On Thu, Mar 4, 2010 at 2:20 AM, anandsk wrote:

    when you use from it becomes the consumer and listens on that port if
    your
    app is running on host.

    If you are trying to identify the corresponding reply to a request, I
    beleive you need to have something in message to identify it uniquely.
    other
    alternative is using synchronus request/reply by setting sync flag to
    true.

    Thanks,
    Anand



    carlo c wrote:
    i was able to use codec successfully,

    however, i am having problems with the replies,

    sometimes i get the reply of another thread using the camel mina
    component.

    how do i ensure that i am getting the proper reply

    i used the following

    mina:tcp://host:port?codec=#codecFactory

    how can i ensure that the reply is for me?

    what i did was to limit the number of consumers to 1 however i don't
    wnt to do this in the future,

    the alternative that i could think is to set a separate

    from("mina:tcp://host:port?codec=#codecFactory") thread, is this the
    correct way to handle this  and set sync to false....
    On Wed, Mar 3, 2010 at 5:04 AM, anandsk wrote:

    If I understand your question correctly, you may want to look at codec
    option
    of camel-mina component.

    Thanks,
    Anand


    carlo c wrote:
    hi there,

    thanks a lot!!
    i'm trying to understand the code in camel-mina and it seems that you
    can configure it to signify that it is a textline? correct?
    but what if the message returning isn't a text line.
    In our case for example, the sample code that i use is

    dis.available() to determine if a message arrived,
    afterwards, i configure a new byte[] in order to be able to read the
    message

    Here is my source code using native java.io api
    // input stream declaration coming from Socket
    DataInputStream dis = **/
    // i'm checking this method (dis.available()) --> this returns the
    number of bytes that an incoming message contains
    byte[] responseByte = new byte[dis.available()];
    //
    dis.readFully(responseByte);

    i somehow do it like this,
    is there anyway that i can do this in camel mina?
    i need to be able to get a response via the size of the input stream
    coming back.

    thanks
    carlo
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27761139.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context:
    http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27771764.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
    --
    View this message in context: http://old.nabble.com/Question-On-Camel-Mina---Multiple-Messages-With-One-IOSession-tp27756509p27772724.html
    Sent from the Camel - Users mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedMar 2, '10 at 2:29p
activeMar 4, '10 at 12:34a
posts13
users4
websitecamel.apache.org

People

Translate

site design / logo © 2022 Grokbase