Getting at BC Application Configurations from JMX

Earlier today I got a question from one of the developers at the client I'm with right now on how can you reuse the configuration information present in a named Application Configuration for a Binding Component.

The case here was that they didn't want the configuration in multiple places in their system, but were happy with reusing the BC's Application Configuration, and wanted to do it from an EJB or servlet, that would not communicate through a BC. The EJB/Servlet must be deployed in a server where the Application Configuration is present for a particular BC.

 This is simple with JMX:

MBeanServer mServer = ManagementFactory.getPlatformMBeanServer();
Properties props =(Properties)mServer.invoke(new ObjectName("com.sun.jbi:ServiceName=ESBConfigurationService,ComponentType=System"), "getApplicationConfiguration", new Object[]{"sun-file-binding","myApplicationConfig", "server"}, new String[]{"java.lang.String","java.lang.String", "java.lang.String"});

 As the Servlet or EJB is already running "in-process" there is no need for credentials to the MBeanServer, these are read automatically from the runtime environment.

Then it's just a trivial matter of looking up the correct MBean (the ObjectName) and invoking the correct operation. JConsole or VisualVM with the MBeans plugin is a great help here.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blog will be about software that i work with; Java, OpenESB, GlassFish and perhaps a bit about photography.

Search

Archives
« July 2015
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today