I am righting an application that uses PhoenixJMS as a block with another block acting as a client -- through standard JMS API. There was a problem with the current Block implement that I pulled from CVS. The EmbeddedJmsServer is executed in a separate Thread during Block initialization. Unfortunately, the JMS server does not complete its startup sequence before the client block requests a ConnectionFactory. Furthermore, the Block does not cleanup on shutdown. I have created a separate Block implementation (specific to Phoenix) that resolves these issues and thought I would share it with the community...do with it as you will. :)
package mil.tveds.mvc.server.message.blocks;
import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.phoenix.BlockContext; import org.exolab.jms.server.EmbeddedJmsServer; import java.io.File; /** * @phoenix:block * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Krieg</a> * @version 1.0 */ public class DefaultJMSMessageServer extends AbstractLogEnabled implements Contextualizable, Initializable, Disposable { public void contextualize(final Context context) throws ContextException { m_blockContext = (BlockContext)context; } public void initialize() throws Exception { final File appHome = m_blockContext.getBaseDirectory(); final File configDir = new File(appHome, "config"); final String config = new File(configDir, "openjms.xml").getCanonicalPath(); System.setProperty("openjms.home", appHome.getCanonicalPath()); m_embeddedJmsServer = new EmbeddedJmsServer(config); m_embeddedJmsServer.init(); } public void dispose() { m_embeddedJmsServer.getServiceManager().removeAll(); } public EmbeddedJmsServer m_embeddedJmsServer; public BlockContext m_blockContext; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
