0

we have several switchyard jar deployed in a JBoss EAP 6.4. Everything works fine but we want to create an event listener to execute some code after the deploy of the application and some other code after the undeploy, but sincerely i don't know where to start. This is our basic switchyard.xml

    <?xml version="1.0" encoding="UTF-8"?>
<sy:switchyard xmlns:bean="urn:switchyard-component-bean:config:2.0" xmlns:resteasy="urn:switchyard-component-resteasy:config:2.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:sy="urn:switchyard-config:switchyard:2.0" name="esb-empty" targetNamespace="urn:it.empty.esb:esb-empty:1.0">
  <sca:composite name="esb-empty" targetNamespace="urn:it.empty.esb:esb-empty:1.0">
    <sca:component name="Component">
      <bean:implementation.bean class="it.empty.esb.service.EmptyServiceBean"/>
      <sca:service name="EmptyService">
        <sca:interface.java interface="it.empty.esb.service.EmptyService"/>
      </sca:service>
    </sca:component>
    <sca:service name="EmptyService" promote="Component/EmptyService">
      <sca:interface.java interface="it.empty.esb.service.EmptyService"/>
      <resteasy:binding.rest name="REST">
        <resteasy:contextMapper class="it.empty.esb.util.RestContextMapper"/>
        <resteasy:interfaces>it.empty.esb.service.EmptyResource</resteasy:interfaces>
        <resteasy:contextPath>esb-empty</resteasy:contextPath>
      </resteasy:binding.rest>
    </sca:service>
  </sca:composite>
    <sy:domain>
      <sy:properties>
        <sy:property name="org.switchyard.handlers.messageTrace.enabled" value="false"/>
      </sy:properties>
    </sy:domain>
</sy:switchyard>

What i want to do is instantiate automatically an org.springframework.context.annotation.AnnotationConfigApplicationContext instead of instatiate manually during the first rest call. Every esb on the server manage a different AnnotationConfigApplicationContext, so i think the event listener has to be inside every esb.

Is it possible? Can you provide me some hints? Is there any other informations needed?

aldroid
  • 25
  • 1
  • 8

1 Answers1

0

I think you have a few options, I'm not real sure what you're trying to do post-deploy and post-undeploy, here are what I think are the best two :

  • deploy your SwitchYard application as a WAR or an EAR, and use the dependencies to order your SwitchYard application and your post-deploy application. I guess you don't even have to deploy your SwitchYard application as a WAR or EAR - it'd be enough if you made a WAR or EAR that module depended on your switchyard application being loaded to get a deploy hook.

  • easiest : do something with whatever script you're using to deploy / undeploy, or whatever script you are using to start/stop EAP

cunningt
  • 111
  • 4
  • I'm trying to instantiate a org.springframework.context.annotation.AnnotationConfigApplicationContext after the deploy is completed and destroy it during undeploy. Actually we instatiate it when the first rest service get called, but we wanted to make it cleaner and automate the process when deploy complete. – aldroid Sep 29 '18 at 09:08