Hi

Rather than extending the JBIServer class, which I first did as well, I
could also recommend the following approach:
JBIContainer container = ((ComponentContextImpl) context).getContainer();

The context you can get through injection. Iam using this approach to deploy
dynamic endpoints to ServiceMix running under JBoss.

Regards

Andreas


Timothy High wrote:
> 
> Hi all,
> 
>  
> 
> I am working on a way to access the JBIContainer from my JBoss application
> so that I can create a local client to send messages. I thought I had
> finally succeeded by adding an accessor method to the JBIServer class: 
> 
>  
> 
>             public JBIContainer getJbiContainer() {
> 
>                         return jbiContainer;
> 
>             }
> 
>  
> 
> Then, my application uses the JBoss MBean server to access the
> JBIServerMBean and get the JBIContext:
> 
>  
> 
>             private JBIContainer getJbiContainer() throws
> MalformedObjectNameException {
> 
>                         MBeanServer server =
> MBeanServerLocator.locateJBoss();
> 
>                         JBIServiceMBean proxy = null;
> 
>                         String objName =
> "org.apache.servicemix:service=JBIService";
> 
>                         ObjectName objectName = new ObjectName(objName);
> 
>                         if (server.isRegistered(objectName)) {
> 
>                                     // Get a type-safe dynamic proxy
> 
>                                     proxy = (JBIServiceMBean)
> MBeanServerInvocationHandler.newProxyInstance(
> 
>                                                            
> (MBeanServerConnection) server, objectName,
> 
>                                                            
> JBIServiceMBean.class, false);
> 
>                         } else {
> 
>                                     throw new
> IllegalArgumentException("MBean " + objName
> 
>                                                             + " does not
> exist");
> 
>                         }
> 
>                         return proxy.getJbiContainer();
> 
>             }
> 
>  
> 
> So far, so good. However, when I try to send a message using this
> container, it can't locate the endpoint or service requested. After some
> debugging, I discovered that the JBIContainer registry is empty. In fact,
> what the JBoss deployer is doing is creating a separate SpringJBIContainer
> for each ServiceMix SA I deploy (actually, I'm currently just testing with
> simple XML configurations):
> 
>  
> 
>             public void installServiceMixXml(String archive) {
> 
>                         // Ok, we are going to use the spring
> infrastructure
> 
>                         // to create a container
> 
>                         log
> 
>                                                 .info("Creating ServiceMix
> JBI installer from XML [" + archive
> 
>                                                                         +
> "]");
> 
>                         List processors = Arrays.asList(new Object[] { new
> XBeanProcessor() });
> 
>                         containerMap.put(archive, new
> ClassPathXmlApplicationContext(archive,
> 
>                                                 processors));
> 
>             }
> 
>  
> 
> So, none of the deployed assemblies have access to any other assemblies -
> each one has effectively its own separate container. Is this the expected
> behavior? Is this how the stand-alone ServiceMix server works? I had
> assumed that you would want a single registry so that components in one
> assembly could communicate with services in another.
> 
> 
> Could someone please clarify this for me?
> 
>  
> 
> Thanks,
> 
> Tim.
> 
> ----------------------------------------------------------
> 
> Timothy High
> 
> Software Engineering
> 
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
> 
>  
> 
> Sakonnet Technology 
> Centro Empresarial Mourisco 
> Praia de Botafogo 501 1°Andar 
> Bloco A - Torre Pão de Açúcar 
> 22250-040  - Rio de Janeiro, RJ Brazil 
> www.sknt.com <http://www.sknt.com/> 
> 
> +55 (21) 2586 6102  direct 
> +55 (21) 2586 6001  fax 
> 
>  
> 
> 
> 
-- 
View this message in context: 
http://www.nabble.com/JBI-Containers-and-the-JBoss-Deployer-tf1998766.html#a5498168
Sent from the ServiceMix - User forum at Nabble.com.

Reply via email to