You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Horace Pinker <fl...@yahoo.com> on 2006/08/17 21:08:28 UTC

how to manually post data to in-queue?

hi,

i'm using an acceptor and would like to manually post data to the in-queue of a connection. for the connection handler it should behave as if the connected client sent the data. is there an offical way to do this?

i would like to do this so that the connection handler state machine receives data from the remote and from a local source in a consitent and ordered way.

any suggestions are welcome.

and: mina is great! :D

cheers,
peter

 		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1ยข/min.

Re: how to manually post data to in-queue?

Posted by Trustin Lee <tr...@gmail.com>.
On 8/21/06, peter royal <pr...@apache.org> wrote:
>
> On Aug 17, 2006, at 3:08 PM, Horace Pinker wrote:
> > i'm using an acceptor and would like to manually post data to the
> > in-queue of a connection. for the connection handler it should
> > behave as if the connected client sent the data. is there an
> > offical way to do this?
> >
> > i would like to do this so that the connection handler state
> > machine receives data from the remote and from a local source in a
> > consitent and ordered way.
> >
> > any suggestions are welcome.
>
> You can achieve this by getting the start of the filter chain for
> your connection, and just calling events on it (you want the
> messageReceived event :)


Here's an example filter that fires a messageReceived event when connection
is open:

public class MyFilter extends IoFilterAdapter {
    public void sessionOpened(NextFilter next, IoSession session) throws
Exception {
        next.sessionOpened(session);
        next.messageReceived(session, <my message>);
    }
}

You could insert this filter in your configuration (IoServiceConfig).

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: how to manually post data to in-queue?

Posted by peter royal <pr...@apache.org>.
On Aug 17, 2006, at 3:08 PM, Horace Pinker wrote:
> i'm using an acceptor and would like to manually post data to the  
> in-queue of a connection. for the connection handler it should  
> behave as if the connected client sent the data. is there an  
> offical way to do this?
>
> i would like to do this so that the connection handler state  
> machine receives data from the remote and from a local source in a  
> consitent and ordered way.
>
> any suggestions are welcome.

You can achieve this by getting the start of the filter chain for  
your connection, and just calling events on it (you want the  
messageReceived event :)

> and: mina is great! :D

excellent! ty!

-pete


-- 
proyal@apache.org - http://fotap.org/~osi