On Wed, 25 Jun 2014 09:15:01 +0200
Fabien Bodard <gambas...@gmail.com> wrote:

> I really dont understand in what case it can be usefull
> 
> Your observer in all case will be created after the object so in this case
> just call a subroutine will do the same
> 
> If you need an info during the init you can give it as param
> 
> Please give more explanation of what you want to achieve
> 
> Regards
> 
> Fabien

It's to do with a class that handles a continuous XML feed for a set of similar 
feeds.  So we have a main form class that creates up to 15 or so instances of a 
"feed watcher" class, each looking at one specific thread.  We have certain 
handlers in the main class that respond to events raised in the feed-watcher 
class.  Once the feed-watcher object is fully instantiated these event handlers 
work fine and the set of feeds is managed fine.  However, some of these events 
can occur during the feed-watcher constructor execution.  Since we already have 
the code to handle them in the main form, I was hoping to not have to create 
special error conditions etc sent back from the feed-watcher._new method, but 
just to raise the relevant during the constructor.

The feeds are from a url like 
"www.xyz.com/auctions/lots.aspx?year=2014&month=6&day=26&lot=113#1".  Where 113 
is one of a set of lot numbers we are interested in.  These feed-watchers set 
up the download structure, get the initial xml result and parse it (read on), 
then wake up on a timer basis and re-request the same url, get the result (its 
an XML document), parse it and depending on some changes to the parsed 
information, raise events that signal to the main form that something has to be 
done, for example, the bidding on that lot has started, finished, etc .  As 
it's an internet based feed, there are some other things that can also happen 
that we need to handle - download errors, loss of connection etc. Further, 
depending on the auction house concerned, setting up the download structure and 
getting the initial packet is complex. So we have a set of these feed-watcher 
classes specialised to handle that initial work.
 
The problem is that some of the conditions that result in the raising of these 
events can also happen during the construction of the feed-watcher object, e.g. 
loss of connection, but also some of the information based events, e.g the 
requested lot has been "cancelled" etc.

As I said, once the feed is established,everything works fine.  It's just that 
initial phase.

The more I think about it, the more I am convinced that it cannot work the way 
we have designed and written it. And we will have to split the initial phase 
into a constructor and an "Initialise" method. So never mind.

(Well, you did ask :-) )

regards
Bruce 


-- 
B Bruen <bbr...@paddys-hill.net>

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to