You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Andreas Held <hl...@bbp.ch> on 2006/07/03 13:23:06 UTC

Dynamic endpoints in JBoss

Hi

I would like to dynamically add endpoints from my Java code. To this 
aim, I do need access to the one and only JBIContainer instance. To get 
hold of this instance, I did patch the JBIService class as follows:

@@ -108,6 +108,28 @@

  	}

  	/**
+	 * Gets the JBI container to use
+	 *
+	 * @return The JBI container
+	 *
+	 * @jmx.managed-attribute
+	 */
+	public JBIContainer getJbiContainer() {
+		return jbiContainer;
+	}
+

This allows me to get a reference to the JBIContainer via JMX, and to 
add my endpoints with jbi.activateComponent(), this works all pretty well.

However, I wondered what the preferred way for doing this would be. 
Ideally, JMX service JBIContainer would expose an interface which could 
be reused via MBeanServerInvocationHandler, however, this is not 
possible in the present implementation. Any other ideas?

Regards

Andreas



Re: Dynamic endpoints in JBoss

Posted by AndreasH <hl...@bbp.ch>.
For the archive, I found this slightly more elegant way to get hold of the
JBIContainer instance:

JBIContainer container = ((ComponentContextImpl) context).getContainer();
container.activateComponent(new ActivationSpec("filePoller_" + id, poller));

The component context can be retrievd by injection, for instance. I don't
know how general this solution is, but at least it looks much better than
patching ServiceMix.

Regards

Andreas
-- 
View this message in context: http://www.nabble.com/Dynamic-endpoints-in-JBoss-tf1884028.html#a5463744
Sent from the ServiceMix - User forum at Nabble.com.