Presentation is loading. Please wait.

Presentation is loading. Please wait.

middleware a guide to middleware construction (roughly) based on Boris

Similar presentations


Presentation on theme: "middleware a guide to middleware construction (roughly) based on Boris"— Presentation transcript:

1 middleware a guide to middleware construction (roughly) based on Boris
(roughly) geared towards Java Simon Lynch

2 what is middleware? a substrate to support system components / subsystems an interface between subsystems an additional level of abstraction

3 what does middleware do?
handles data/message passing between subsystems provides clean subsystem interfacing allowing greater encapsulation & interoperability adding a new level of abstraction “glues (sub)systems together”

4 what may it also do? facilitate easier concurrency for subsystems
allow distribution provide system diagnostics allow dynamic reconfiguration manage resources

5 building middleware NB: these notes based on Boris philosophy
meta-agents / meta-actors building blocks blocking queue  (spooler)  meta-agent  Portal agent, socket agent, interface agent PS: assume (here) all messages are Strings

6 messages & threads see example… message sending message receiving
clones non-clones

7 a meta-agent subsystem

8 the blocking queue eg: class LinkedBlockingQueue<E>
extends AbstractQueue<E> implements BlockingQueue<E>, Serializable  void put(E e) Inserts element at the tail of queue, waiting if necessary for space to become available.  E take() Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.

9 meta-agent meta-agent extends blocking-queue variables: name, portal
constructor method( args... ) | super.constructor( args... ) | thread{ loop-forever | msgHandler ( dequeue() )} void msgHandler( String msg ) | ... msg processing code goes here...

10 msgs via portals (i) agents sharing a portal
(ii) agents with their own portal

11 portal portal extends meta-agent variables: routing-table
void msg-handler(msg) | routing-table.get( | recipient-of(msg)).enqueue(msg) void add-agent( name, agent ) | routing-table.set( name, agent ) so... meta-agent.send-message(recipient, msg) | portal.enqueue( | wrap(name, recipient, msg)

12 comms with sockets

13 name mapping #1 P1 : { A1  | A1| , A2  | A2| }

14 name mapping #2 P1 : { A1  | A1| , A2  | P2| } P2 : { A1  | P1| , A2  | A2| }

15 name mapping #3 P1 : { A1  | A1| , A2  | S1| } P2 : { A1  | S2| , A2  | A2| }

16 usr-agent #1 usr-agent variables: metaAgent, msgHandler
constructor method( args... ) | metaAgent = new MetaAgent( args... ) | ...other stuff... void sendMessage( String to, String msg) | ... add who from & send ... ...other methods...

17 usr-agent #2 usr-agent variables: metaAgent, msgHandler
constructor method( args... ) | metaAgent = new MetaAgent( args... ) | ...other stuff... void msg-handler(msg) | if msgHandler != null | msgHandler.processMsg( ...un-wrapped msg...) void addMsgHandler( MsgHandler m )... NB: MsgHandler is an Interface with a method... void processMsg( String )


Download ppt "middleware a guide to middleware construction (roughly) based on Boris"

Similar presentations


Ads by Google