[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] Embedding xmlBlaster into Apache Avalon Phoenix



Idris B Saliu wrote:

Hi All,
I'm trying to port an avalon phoenix component which is currently using an embedded JMS server to xmlblaster. and I ran into some problem. I would like to have other blocks within same jvm as xmlBlaster get a connection to xmlblaster using a look up service. Here is what the for my previous application looks like :


Here I create an embedded jms server
public void initialize() throws Exception
{
m_server = new MessageServer(m_serverProperties);


this.m_initialized = true; }

when a client needs a connection using a service selector, it gets whatever is returned by this method

public TopicConnectionFactory getTopicConnectionFactory()
{
TopicConnectionFactory connectionFactory = new PipeConnectionFactory(this.m_server);



return connectionFactory; }


Here is what I did for xmlblaster, I copied this from some example in the test directory in xmlblaster

Yes, in the testsuite we do the same all the time.



public void initialize() throws Exception
{
if (this.startEmbedded) {
glob.init(Util.getOtherServerPorts(serverPort)); // I'm not sure
String[] args = {}; // what this

You can set any environment with args which configure the embedded xmlBlaster server, e.g.
on which port CORBA listens etc.
Try
java org.xmlBlaster.Main -help
for a (not complete) list of properties.
All properties from command line or from xmlBlaster.properties you can specify with args.



glob.init(args); // 3 lines actually does tried reading the api but got lost somewhere

Here you initialize a Global object with the args configuration.
Take another Global instance for another embedded server instance if desired.




serverThread = EmbeddedXmlBlaster.startXmlBlaster(glob);
}

Now I would like to have other components running in the same jvm get a connection to the serverThread via a factory. I hope I made some sense with this.

You create an XmlBlasterAccess instance for every client instance. You configure the client instances with separate Global instances, similar to the above example. XmlBlasterAccess will then connect to the embedded server (see for example HelloWorld6.java on how to configure XmlBlasterAccess hard coded)

regards

Marcel