Mulligan, Patrick wrote:
Seems to me that we would barf if they tried to create two bus'es of the
same name. I agree, the default bus could, or maybe should, be zero?
You can create any number of buses with the same id - and each one may
behave differently, according to which cfg file(s) that were used for
its initialisation - they buses all have their own application context.
SpringBusFactory.createBus("one.xml") and
SpringBusFactory.createBus("two.xml") both result in a bus with a null
id - the bus id is not set anywhere at the moment. If the bus id is not
obsoleted, this should at least be set to "cxf", which corresponds to
the id of the bean that is retrieved in the process.
-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Monday, February 12, 2007 2:54 PM
To: [email protected]
Subject: Re: Bus ID
On Monday 12 February 2007 11:19, Dan Diephouse wrote:
On 2/12/07, Soltysik, Seumas <[EMAIL PROTECTED]> wrote:
For the purposes of the JMX infrastructure I would like to provide
the
user with a convenient way of viewing all MBeans associated with a
particular Bus. Incorporating the BusID into the ObjectName of an
MBean
is a user friendly way of communicating to the user the relationship
between the MBean and its associated Bus. However, it does not
appear
that there is any guarantee(within a particular classloader) of the
uniqueness of the BusID value. If this is true then I am confused as
to
the value of the BusID. It seems to me that CXF should enforce ID
uniqueness or get rid of the BusID entirely.
In complete agreement on your statement.
I don't really understand the point of the Bus ID personally. So I
would be
+1 to getting rid of it. However if its deemed useful for the JMX
scenario
that you outline, thats fine too.
At one point, the Bus ID was used in the config files for configuring
bus
level things like the workqueue and bus level interceptors. With the
new
config stuff, I'm not sure if that's true or not anymore. If not,
how
would someone configure those things?
Basically, if I have 5 Bus's in my application, how would I configure
each one
uniquely?
There are two ways to do this:
a) create them in different application contexts (using different cfg
file urls in the bus factory method) or
b) declare multiple beans of class org.apache.cxf.bus.CXFBusImpl in the
your cfg file (the beans itself must have a different id then, or else
one overwrites the other), and wanted to access the corresponding bus
instances accordingly, you would need to pass the id to the bus factory
method:
SpringBusFactory.createBus("bus1", "multi.xml") could be implemented as:
get the bean with id "bus1" (provided it implements the Bus interface).
Right now we always retrieve the bean named "cxf".
You would have to duplicate a lot of information currently contained in
the cxf-* cfg file fragments though, and the preferred way of creating
multiple buses therefore would be a). in which case the bus ids are not
needed.
If we think there is no need to support multiple buses in the *same*
application context (which IMO I don't think there is), we should get
rid of the bus id.
In case b), if something is needed to distinguish the individual buses,
I think it would be more useful if it related to the underlying
application context (e.g. the url used in its initialisation) rather
than a static counter.
Andrea.
Instead of the default being "null", I would think it might be a good
idea to
keep a static counter someplace and each time a bus is created with no
ID,
just use "CXF-Bus-#" or similar so they would each be relatively unique.
It
wouldn't guarantee uniqueness as someone could create two or more busses
with
the same ID, but in the default case of not specifying it, they'd be
unique.