Calling jmx service with osgi service | Community
Skip to main content
Magicr
Level 6
October 10, 2022
Solved

Calling jmx service with osgi service

  • October 10, 2022
  • 3 replies
  • 2314 views

Hello,

I want to synchronise all user within the instance to particular time. Normaly doing a scheduled job by creating a service and an appropiate config. But how can I achive it with a jmx service? In example synchronsing groups and users from ldap seems only be available as jxm service. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Magicr

I found a suitable way to call a jmx service from AEM. This way is documented at https://kbwebconsult.com/aem-automatic-user-synchronization-with-ldap. It can also be found here in this forum at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-ldap-synchronization-scheduler/m-p/415758

The pitfall for AEM 6.5 is the string to create the nessecary domain. The presented syntax did not work at me. To solve this issue I used the tool Jconsole wich is provided by java jdk it self.

3 replies

arunpatidar
Community Advisor
Community Advisor
October 11, 2022
Magicr
MagicrAuthor
Level 6
October 11, 2022

Uhm why shall I create a new mbean when the user sync is already provided as this ? 

arunpatidar
Community Advisor
Community Advisor
October 11, 2022

Sorry, I misread the question. I thought you wanted to use JMX for your services.

 

But I am not sure if it is possible to call JMX services from another OSGI service. Although JMX mbean is also a service, so you should be able to call it from another OSGI service if the LDAP service is exported. You can try though.

Arun Patidar
Lokesh_Vajrala
Community Advisor
Community Advisor
October 11, 2022

I think you can use OSGi ServiceTracker to get the service you wanted from OSGi and then call the user synchronization method.

 

protected void activate(final ComponentContext componentContext) {
        this.serviceTracker = new ServiceTracker(
            componentContext.getBundleContext(),
            SERVICE.class.getName(),
            null
        );
        this.serviceTracker.open();
    }

----
this.serviceTracker.getService().userSync(); 

 

Magicr
MagicrAuthor
Level 6
October 25, 2022

Hello, after long time and lots of serveral tries it ends into a dead end. I was unable to get the jmx service with this way.

Magicr
MagicrAuthorAccepted solution
Level 6
October 25, 2022

I found a suitable way to call a jmx service from AEM. This way is documented at https://kbwebconsult.com/aem-automatic-user-synchronization-with-ldap. It can also be found here in this forum at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-ldap-synchronization-scheduler/m-p/415758

The pitfall for AEM 6.5 is the string to create the nessecary domain. The presented syntax did not work at me. To solve this issue I used the tool Jconsole wich is provided by java jdk it self.