I've been busy, but hopefully I can come back to this project now. I have started to
build a prototype with MINA. Mostly I am focusing on a JBC binary protocol, however,
handling additional protocols should flow naturally using features built into MINA.
The primary access to the cache will be via a binary protocol. This provides for
efficiency as well as extensibility.
A Prototypical JBoss Cache Request
Byte Description
Byte 0 (0x90) JBoss Cache Request Marker
-----------------------------------------------------------
Byte 1
Byte 2 A Java int containing the request type.
Byte 3
Byte 4
-------------------------------------------------------------
Byte 5
.
. Data specific to the request type.
.
Byte n
The Initial Byte
The initial byte marker serves two main purposes. First, it allows the parser to
confirm that the currently read byte is the beginning of a JBoss cache binary request.
Secondly, a JBoss Cache MessageDecoder (A MINA MessageDecoder) can check the value of
this byte in its decodable method and return true only if the byte matches the 0x90 JBoss
Cache request marker.
If the JBoss Cache MessageDecoder is used within a DemuxingProtocolDecoder (another MINA
class) along with, say, a memcached MessageDecoder, the server can identify the protocol
used in each request by examining the lead byte, and invoke the appropriate message
decoder.
Likely values for the first byte identifying the protocol.
Value Meaning
0x80 memcached binary request
0x81 memcached binary response
0x90 JBoss Cache binary request
0x91 JBoss Cache binary response
The Message Type
The next field is a java int written into four bytes of the message. This identifies the
specific type of message. It is used in a RequestDecoder (another standard MINA class)
class to select the appropriate builder for the request.
Data Specific to the Message Type
The builder reads the remainder of the input stream, and constructs a Request object,
which will be passed in to the IoHandler where it will carry out the expected actions on
the cache.
Right now, I am working through an implementation of a single test flow to be sure that
the plumbing can generally work.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224947#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...