You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by da...@daune-consult.com on 2006/06/29 12:02:15 UTC

Filter question

Hi,

I face the current situation:

1) a device connects to my server and sends a first message to  
initiate a logical session
2) the server replies
3) the device now listens on the port
4) the server sends some requests (and waits for replies)
5) when it has finished, the server sends a final message to close  
logical session
6) the device replies and closes connection

I thought that I could use a filter to handle message exchanges of 1),  
2), 5) and 6). A separate handler would deal with exhanges in 4).

The filter would completely hide logical session handling. This means that

a) the handler would receive a sessionOpened() when filter has  
completed point 2).
b) a call to close() by the handler would initiate 5)

I have implemented it, but when I write a message in my filter, the  
messageSent is never called.

Where am I wrong?

J-F




Re: Filter question

Posted by da...@daune-consult.com.
Quoting peter royal <pr...@apache.org>:

> On Jun 29, 2006, at 11:02 AM, daune.jf@daune-consult.com wrote:
>> I face the current situation:
>>
>> 1) a device connects to my server and sends a first message to    
>> initiate a logical session
>> 2) the server replies
>> 3) the device now listens on the port
>> 4) the server sends some requests (and waits for replies)
>> 5) when it has finished, the server sends a final message to close   
>>  logical session
>> 6) the device replies and closes connection
>>
>> I thought that I could use a filter to handle message exchanges of   
>>  1), 2), 5) and 6). A separate handler would deal with exhanges in  
>> 4).
>>
>> The filter would completely hide logical session handling. This  means that
>>
>> a) the handler would receive a sessionOpened() when filter has    
>> completed point 2).
>> b) a call to close() by the handler would initiate 5)
>>
>> I have implemented it, but when I write a message in my filter, the  
>>   messageSent is never called.
>>
>> Where am I wrong?
>
> Have you tried setting a callback on the WriteFuture to help you debug?
>
> -pete
>

Sorry for noise,

my filterWrite was eating the message.

J-F



Re: Filter question

Posted by peter royal <pr...@apache.org>.
On Jun 29, 2006, at 11:02 AM, daune.jf@daune-consult.com wrote:
> I face the current situation:
>
> 1) a device connects to my server and sends a first message to  
> initiate a logical session
> 2) the server replies
> 3) the device now listens on the port
> 4) the server sends some requests (and waits for replies)
> 5) when it has finished, the server sends a final message to close  
> logical session
> 6) the device replies and closes connection
>
> I thought that I could use a filter to handle message exchanges of  
> 1), 2), 5) and 6). A separate handler would deal with exhanges in 4).
>
> The filter would completely hide logical session handling. This  
> means that
>
> a) the handler would receive a sessionOpened() when filter has  
> completed point 2).
> b) a call to close() by the handler would initiate 5)
>
> I have implemented it, but when I write a message in my filter, the  
> messageSent is never called.
>
> Where am I wrong?

Have you tried setting a callback on the WriteFuture to help you debug?

-pete


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