[Gambas-user] Messaging between arbitrary objects

Benoît Minisini gambas at ...1...
Fri Aug 11 13:58:50 CEST 2017


Le 11/08/2017 à 13:47, adamnt42 at ...626... a écrit :
> 
> Since it's soon to be the busiest time of our year (the spring thoroughbred auctions) I thought I'd just redesign our entire auction management system (haha).
> 
> On any day we may have up to 10 or so auctions in progress at the same time. Some online (conducted by us or others) and some live (using our sale manager, which talks back to us) (and some we have no idea about).  Last year, a change in the industry permitted a particular horse to be entered in more than one auction, to be withdrawn from subsequent lots if sold in a previous lot.  You can imagine the mess this caused, both in setting schedules and in communicating between the auction houses.  Luckily, last year the idea didn't really catch on in a big way, but over the year interest has been growing.  Suffice to say we have a system that allows us to watch for sales of this type and manage them (at least in the auctions we "control"). The current way we do it is to have multiple "auction" monitors running as separate invocations of the monitor project.  The only communication between them is via the human operators who have to watch each lot ... etc etc.
> Basically what I'm trying to do is have a single monitor that shows the progress of sales across a number of active auctions, sending messages between arbitrary pairs (or multiples) when a "marked" lot is either sold or passed in by an auction where it is the "early" one.  So we have a main "controller" that launches a number of auction monitors and a particular monitor knows when a "marked" lot is offered and then sold or passed in.  I can raise an event in the monitor, caught by the controller when another monitor object needs to be told to allow the sale of a "marked" lot to proceed or to withdraw it.  The main controller then has to work out which of the other monitor instances is interested in this particular horse and then pass it a message via a public routine call.  This is to put it mildly, bloody difficult and damned messy.
> 
> What I'd like to do is have each monitor catch events from some other monitor both of whom are handling a "marked" lot. The controller when it invokes each monitor is able to indicate such marked pairs to each auction monitor (I have that bit worked out).  The "conversation" I envisage would go along these lines:
>                                                                                                                                    AuctionA                    AuctionB
> 1. When a marked lot is coming up for sale, i.e. in the next 5 lots offered                     | -------------------------->| "Lock lot X"
> 2. When the horse is offered and sold in the first auction                                              | -------------------------->| "Withdraw lot X"
> 3. When the horse is passed in at the first auction                                                        | -------------------------->| "Unlock lot X"
> 4. Exception: when a certain time period has passed since message 1                        | <------------------------- | "Query lot X"
>                                                                                                                                        | --------------------------->| "Response (lock or unlock) lot X"
> 5. Exception: no response to query                                                                                                                    | --------------------------------------------> Alert controller
> 
> (It's a bit more complex, but that is the general sense of it.)
> 
> So, is there a way that I can tell the "AuctionB" monitor to listen for events raised by the "AuctionA" monitor?  I thought I might be able to use the gb.qt4 "Watcher" for this but I can't seem to get it to happen.  Is that the way to go? Any other ways or ideas.
> 
> tia
> (and thanks for reading this very long post.)
> 
> bruce
> 
>   
>   
> 

If you have multiple processes that want to communicate, why not using 
D-Bus ?

-- 
Benoît Minisini




More information about the User mailing list