JBoss Community

Re: Esb service and EJB3 Action or JBESB-2134 continuation...

created by Maksym RMA in JBoss ESB Development - View the full discussion

I fix it with creating custom EJBProcessor.

ESB action in jboss-esb.xml looks like:

 

<action name="ejb-action" class="com.mypackage.CustomEJBProcessor">

 

CustomEJBProcessor is:

 

package com.mypackage;

 

import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;


public class CustomEJBProcessor extends org.jboss.soa.esb.actions.EJBProcessor{

private boolean isInited = false;

public CustomEJBProcessor(ConfigTree config) {
  super(config);
}

 

 



@Override
public void destroy() {
  super.destroy();
}

@Override
public void initialise() throws ActionLifecycleException {
  //super.initialise(); --- IT'S  PROBLEM METHOD! It called when esb resvice deployes by HDScaner BUT EJB3 Bean haven't deployed yet.
  System.out.println("watsuppppp fuck!!!");
}

@Override
public Message process(Message arg0) throws ActionProcessingException, ConfigurationException {
  if(!isInited){
   try {
    super.initialise(); //Call once in first call of service! EJB is alreary deployed!
    isInited = true;
   } catch (ActionLifecycleException e) {

     //Probably need add some processing... but in practice I didn't catch any error here
    e.printStackTrace();
   }
  }
  return super.process(arg0);
}
}

 

AND don't forget include:

<jboss-6.1_home>/server/<your_conf>/deploy/slsb.esb/jbossesb-slsb.jar to your application classpath.

 

Good luck!

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community