You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Jean-François Daune <da...@daune-consult.com> on 2005/10/10 19:52:52 UTC

[Mina] Best to have prioritary messages

Hi,

I face a tough problem. My server application needs to prioritize some 
messages.

I mean that when a message of type X is received, it should be processed 
before any other ones.

Actually, the best would be that a message X whose 'age' is higher than 
S seconds should be promoted as first one to process.

In a way, it is QoS at message-handling level.

What is the best way in Mina to implement this?

Maybe using a filter?

Regards,

J-F

Re: [Mina] Best to have prioritary messages

Posted by Justin Rudd <ju...@gmail.com>.
> > I face a tough problem. My server application needs to prioritize some
> > messages.
[snip]
> > Maybe using a filter?
>
>
> Well, that looks fairly like a stateful filter so I would think it is
> rather appropriate. (actually a filter is useful for anything :)
> but how do you plan to handle your priority buffer ?
>

if you are using Java 5, you can use
java.util.concurrent.PriorityBlockingQueue.  I believe the Doug Lea
concurrent package for 1.4.x includes a PriorityBlockingQueue, but I
don't recall off the top of my head.

What I'm wondering is how would the filter work?  Put a filter in that
collects the writes, add them to the priority queue, and the pop the
top one off the queue and send it to the next filter?  That sound
about right?

I haven't worked with filters at all (other than the prexisting thread
pool filters).

--
Justin Rudd
"Get the facts first.  You can distort them later."
   - Mark Twain
http://seagecko.org/thoughts/

Re: [Mina] Best to have prioritary messages

Posted by Stephane Bailliez <sb...@apache.org>.
Jean-François Daune wrote:

> Hi,
>
> I face a tough problem. My server application needs to prioritize some 
> messages.
> I mean that when a message of type X is received, it should be 
> processed before any other ones.
> Actually, the best would be that a message X whose 'age' is higher 
> than S seconds should be promoted as first one to process.
> In a way, it is QoS at message-handling level.
> What is the best way in Mina to implement this?
> Maybe using a filter?


Well, that looks fairly like a stateful filter so I would think it is 
rather appropriate. (actually a filter is useful for anything :)
but how do you plan to handle your priority buffer ?

Re: [Mina] Best to have prioritary messages

Posted by Trustin Lee <tr...@gmail.com>.
Hi Jean-François,

2005/10/11, Jean-François Daune <da...@daune-consult.com>:
>
> I face a tough problem. My server application needs to prioritize some
> messages.
>
> I mean that when a message of type X is received, it should be processed
> before any other ones.
>
> Actually, the best would be that a message X whose 'age' is higher than
> S seconds should be promoted as first one to process.
>
> In a way, it is QoS at message-handling level.
>
> What is the best way in Mina to implement this?


Yes, implementing a filter is the best solution as others noticed. Possibly
you'll have to implement your own ThreadPoolFilter or modify existing one.

BTW thanks for your good idea of QoS. :)

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/