On Fri, 1 Jun 2001, Peter Antman wrote:
>
> You see what will happen? Yes, the client will send its messages to one
> topic (no automatic creation here), and the MDB will listen on ANOTHER
> topic, namely a to the system unknown destination, since it was not
> correctly spelled.
>
> What do you other guys say on the list? Hiram?

I agree with you it's not a good change. If the developer has made a
mistake in his code or forgot to add the topic he should be warned during
the deployment, instead of allowing the application to silently fail.

Also, since the created topics are persistent, this requires the developer
to go clean up the jbossmq configuration file from time to time to make
sure resources aren't wasted on topics that never meant to be there in the
first place. I think thats worse than the requirement of having to create
the topic upfront, especially since the developer may not even be aware he is
accidentally creating new topics.

So if the idea was to help the developer to avoid finding out about our
obscure configuration files, I think this change may have made the problem
even worse. Now you HAVE TO go browse them, just to fix your typos that
won't go away.

-- Juha


 >
> //Peter
>
> On 31 Maj, [EMAIL PROTECTED] wrote:
> >   User: thedug
> >   Date: 01/05/31 16:53:44
> >
> >   Modified:    src/main/org/jboss/ejb/plugins/jms JMSContainerInvoker.java
> >   Log:
> >   Add auto generation for topic/queue if topic/queue doesn't already exist.
> >   Uses the mbean server to create a new topic/queue..
> >
> >   Revision  Changes    Path
> >   1.11      +54 -7     
>jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java
> >
> >   Index: JMSContainerInvoker.java
> >   ===================================================================
> >   RCS file: 
>/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java,v
> >   retrieving revision 1.10
> >   retrieving revision 1.11
> >   diff -u -r1.10 -r1.11
> >   --- JMSContainerInvoker.java      2001/05/07 19:19:57     1.10
> >   +++ JMSContainerInvoker.java      2001/05/31 23:53:44     1.11
> >   @@ -45,18 +45,24 @@
> >    import org.jboss.jms.jndi.JMSProviderAdapter;
> >    import org.jboss.jms.asf.ServerSessionPoolFactory;
> >
> >   +import org.exolab.jms.client.JmsServerSessionPool;
> >   +
> >    import org.w3c.dom.Element;
> >
> >   +import javax.management.MBeanServerFactory;
> >   +import javax.management.MBeanServer;
> >   +import javax.management.ObjectName;
> >   +
> >    /**
> >     * ContainerInvoker for JMS MessageDrivenBeans, based on JRMPContainerInvoker.
> >     *      <description>
> >   - *
> >   + *
> >     *      @see <related>
> >     *      @author Peter Antman ([EMAIL PROTECTED])
> >     *      @author Rickard �berg ([EMAIL PROTECTED])
> >     *      @author <a href="mailto:[EMAIL PROTECTED]";>Sebastien 
>Alborini</a>
> >     *      @author <a href="mailto:[EMAIL PROTECTED]";>Marc Fleury</a>
> >   - *      @version $Revision: 1.10 $
> >   + *      @version $Revision: 1.11 $
> >     */
> >    public class JMSContainerInvoker implements
> >    ContainerInvoker, XmlLoadable
> >   @@ -205,7 +211,24 @@
> >
> >           // Set up pool
> >           ServerSessionPoolFactory poolFactory = 
>(ServerSessionPoolFactory)jbossContext.lookup(serverSessionPoolFactoryJNDI);
> >   -
> >   +
> >   +       // jndiSuffix is merely the name that the user has given the MDB.
> >   +       // since the jndi name contains the message type I have to split at the 
>"/"
> >   +       // if there is no slash then I use the entire jndi name.....
> >   +       String jndiSuffix = "";
> >   +       if(destinationJNDI != null){
> >   +            int indexOfSlash = destinationJNDI.indexOf("/");
> >   +            if(indexOfSlash != -1){
> >   +          jndiSuffix = destinationJNDI.substring(indexOfSlash+1);
> >   +            }else{
> >   +                  jndiSuffix = destinationJNDI;
> >   +            }
> >   +
> >   +    // if the jndi name from jboss.xml is null then lets use the ejbName
> >   +    }else{
> >   +        jndiSuffix = config.getEjbName();
> >   +    }
> >   +       MBeanServer server = 
>(MBeanServer)MBeanServerFactory.findMBeanServer(null).iterator().next();
> >
> >           if (destinationType.equals("javax.jms.Topic"))
> >        {
> >   @@ -230,7 +253,18 @@
> >                }
> >
> >            // Lookup destination
> >   -        Topic topic = (Topic)context.lookup(destinationJNDI);
> >   +           // First Try a lookup.
> >   +           // If that lookup fails then try to contact the MBeanServer and 
>inoke a new...
> >   +           // Then do lookup again..
> >   +        String topicJndi = "topic/"+jndiSuffix;
> >   +        Topic topic;
> >   +        try{
> >   +           topic = (Topic)context.lookup(topicJndi);
> >   +            }catch(NamingException ne){
> >   +                   Logger.log("JndiName not found:"+topicJndi + "...attempting 
>to recover");
> >   +                   server.invoke(new ObjectName("JMS","service","JMSServer"), 
>"newTopic", new Object[]{jndiSuffix}, new String[] {"java.lang.String"});
> >   +                   topic = (Topic)context.lookup(topicJndi);
> >   +            }
> >
> >            pool = poolFactory.
> >                getServerSessionPool(
> >   @@ -293,10 +327,23 @@
> >                    queueConnection = queueFactory.createQueueConnection();
> >                }
> >
> >   -        // Lookup destination
> >   -        Queue queue = (Queue)context.lookup(destinationJNDI);
> >   +              // Lookup destination
> >   +              // First Try a lookup.
> >   +       // If that lookup fails then try to contact the MBeanServer and inoke a 
>new...
> >   +              // Then do lookup again..
> >   +       String queueJndi = "queue/"+jndiSuffix;
> >   +       Queue queue;
> >   +       try
> >   +                {
> >   +         queue = (Queue)context.lookup(queueJndi);
> >   +         }
> >   +                catch(NamingException ne){
> >   +           Logger.log("JndiName not found:"+queueJndi + "...attempting to 
>recover");
> >   +           server.invoke(new ObjectName("JMS:service=JMSServer"), "newQueue", 
>new Object[]{jndiSuffix}, new String[] {"java.lang.String"});
> >   +           queue = (Queue)context.lookup(queueJndi);
> >   +         }
> >
> >   -        pool = poolFactory.
> >   +       pool = poolFactory.
> >                getServerSessionPool(
> >                                     queueConnection,
> >                                     maxPoolSize,
> >


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to