Subject | Re: firebird events question |
---|---|
Author | russellbelding |
Post date | 2004-09-17T21:24:37Z |
--- In firebird-support@yahoogroups.com, "Photios Loupis (4T)"
<loupisp@a...> wrote:
Thanks for you comments. Yes I do have requirements different from
yours and I modified your idea to suit my need.
I wonder if it would be possible for the firebird developers to
modify the event listener regisration code so that a client listening
for events could register for events such as 'MY_EVENT*' and then be
sent all events with names matching 'MY_EVENT*'?
I think this capability would be benefical to both of us.
For example: ...
At present the server-side event notification is triggered by the
invocation of POST_EVENT 'ANYNAME'
There seems to be no possibility (please correct me anyone if I am
wrong) to send an addittional parameter with 'ANYNAME', such as
sending back a key for the record just inserted or updated. Inside
the trigger or procedure calling POST_EVENT the event name can
be "mangled" to produce "ANYNAME:1234567" but this changes the name
of the event and on the client side only a client who has registered
as a listener for an event named "ANYNAME:1234567" wil be notified.
By contrast if a client could register as a listener for events
like 'ANYNAME*' then they would get notice of
event "ANYNAME:1234567", peel off the key value "1234567" and process
the event 'ANYNAME' as they wish.
So here is a simple case for expanding the event notification code to
allow for registering for events named with wild card names.
Is there a way to achieve this functionality with using the existing
scheme?
Thanks,
Russell
<loupisp@a...> wrote:
> I have not needed to CAST the INTEGER field for the EVENT. I havethan
> used it as is. By the way I am using Delphi 7 with the TIBEvents
> component.
>
> I believe that you could get away with using only 1 event rather
> 2, but I say this not fully understanding the functionality youneed.
Thanks for you comments. Yes I do have requirements different from
yours and I modified your idea to suit my need.
I wonder if it would be possible for the firebird developers to
modify the event listener regisration code so that a client listening
for events could register for events such as 'MY_EVENT*' and then be
sent all events with names matching 'MY_EVENT*'?
I think this capability would be benefical to both of us.
For example: ...
At present the server-side event notification is triggered by the
invocation of POST_EVENT 'ANYNAME'
There seems to be no possibility (please correct me anyone if I am
wrong) to send an addittional parameter with 'ANYNAME', such as
sending back a key for the record just inserted or updated. Inside
the trigger or procedure calling POST_EVENT the event name can
be "mangled" to produce "ANYNAME:1234567" but this changes the name
of the event and on the client side only a client who has registered
as a listener for an event named "ANYNAME:1234567" wil be notified.
By contrast if a client could register as a listener for events
like 'ANYNAME*' then they would get notice of
event "ANYNAME:1234567", peel off the key value "1234567" and process
the event 'ANYNAME' as they wish.
So here is a simple case for expanding the event notification code to
allow for registering for events named with wild card names.
Is there a way to achieve this functionality with using the existing
scheme?
Thanks,
Russell
>file
> --- In firebird-support@yahoogroups.com, "russellbelding"
> <russell@b...> wrote:
> > I think I understand your idea. For each connection to the DB
> Ithe
> > assign an application a SESSION_ID. Each client application knows
> its
> > SESSION_ID. Each table of interest to me should have a SESSION_ID
> > column. Each change to the DB changes the session ID_column to
> > SESSION _ID of the client making the change.listeners
> >
> > Each trigger I use issues two POST_EVENTs
> > POST_EVENT cast(new.SESSION_ID as varchar(16))
> > POST_EVENT 'EVENT_NAME'
> >
> > Each form registers to listen for EVENT_NAME and
> SESSION_ID.asString.
> >
> > As I only want to act on events I did not cause, whenever I get a
> > SESSION_ID event along with the 'EVENT_NAME' event, I ignore
> > the 'EVENT_NAME' event.
> >
> > This would work for me after I addedd a new column to each table.
> >
> > Thanks
> >
> > Russell
> >
> > --- In firebird-support@yahoogroups.com, "Photios Loupis (4T)"
> > <loupisp@a...> wrote:
> > > I have a similar situation that I have found a way around.
> > >
> > > For every record INSERTED into my db I used the triggers to
> > associate
> > > the message to a client and client application. I have
> > > that process records based on the ApplicationId assignedto thetriggers
> > record
> > > based on certain rules. The event that is raised uses the
> > > ApplicationId as the event name in the AFTER_INSERT trigger, ie
> > >
> > > POST_EVENT NEW."ApplicationId";
> > >
> > > The listeners configuration contains which ApplicationIds they
> > > process and so when they are loaded they modify the TIBEvents
> > > component and register the event(s). Upon receiving the event
> the
> > > query the db for records and process them...etc etc
> > >
> > > Hope this helps
> > >
> > > --- In firebird-support@yahoogroups.com, "russellbelding"
> > > <russell@b...> wrote:
> > > > I am using After-Insert, After-Update and After-Delete
> > andto
> > > > in them POST_EVENT lines to signal that a table has changed
> > > > listeners. So my statements are likehave
> > > > POST_EVENT 'EVENT_NAME'
> > > > TO receive these events clients register as a listener
> > > > for 'EVENT_NAME'.
> > > >
> > > > If I am the client who made the event happen I do not want to
> act
> > > on
> > > > the event. If another client made the event happen I want to
> take
> > > an
> > > > action.
> > > >
> > > > If listeners could register to be notified for
> > events 'EVENT_NAME*'
> > > > they could get notification of events named
> > > > 'EVENT_NAME001', 'EVENT_NAME002' and so on. But Firebird does
> not
> > > yet
> > > > permit having wildcards in listener registration (does it?).
> > > >
> > > > Is there any reliable way for me to not act on an event I
> > > > caused?
> > > >
> > > > Thanks for any suggesions.
> > > >
> > > > Russell Belding