Either use JNDI (see numerous examples shipped with Artemis) or don't use a 
lookup at all (i.e. just instantiate the destination programmatically).


Justin

----- Original Message -----
From: "mcacker" <mitchell.ackerma...@gmail.com>
To: users@activemq.apache.org
Sent: Friday, September 16, 2016 1:18:07 PM
Subject: EmbeddedJMS doesn't register JMS topics or queues

Hi,

I'm in the process of migrating from HornetQ to Artemis and have run into an
issue with EmbeddedJMS.  After processing the configuration file, i'm
expecting the MapBindingRegistry (i'm not using JNDI) to have references to
the configured queues and topics, like it did in HornetQ, but the registry
is empty.

Stepping through the code, that step is now performed if the queue
configuration has a binding specified (from JMSServerManagerImpl):

   protected boolean internalCreateJMSQueue(final boolean storeConfig,
                                            final String queueName,
                                            final String selectorString,
                                            final boolean durable,
                                            final boolean autoCreated,
                                            final String... bindings) throws
Exception {

      if (active && queues.get(queueName) != null) {
         return false;
      }

      runAfterActive(new WrappedRunnable() {
         @Override
         public String toString() {
            return "createQueue for " + queueName;
         }

         @Override
         public void runException() throws Exception {
            checkBindings(bindings);

            if (internalCreateQueue(queueName, selectorString, durable,
autoCreated)) {

               ActiveMQDestination destination = queues.get(queueName);
               if (destination == null) {
                  // sanity check. internalCreateQueue should already have
done this check
                  throw new IllegalArgumentException("Queue does not
exist");
               }

               String[] usedBindings = null;

*               if (bindings != null) {
                  ArrayList<String> bindingsToAdd = new ArrayList<>();

                  for (String bindingsItem : bindings) {
                     if (bindToBindings(bindingsItem, destination)) {
                        bindingsToAdd.add(bindingsItem);
                     }
                  }

                  usedBindings = bindingsToAdd.toArray(new
String[bindingsToAdd.size()]);
                  addToBindings(queueBindings, queueName, usedBindings);
               }
*
               if (storeConfig && durable) {
                  storage.storeDestination(new
PersistedDestination(PersistedType.Queue, queueName, selectorString,
durable));
                  if (usedBindings != null) {
                     storage.addBindings(PersistedType.Queue, queueName,
usedBindings);
                  }
               }
            }
         }
      });


but looking at the configuration parser, there is no way of specifying such
a binding, the element isn't supported:

   public static JMSQueueConfiguration parseQueueConfiguration(final Node
node) throws Exception {
      Element e = (Element) node;
      NamedNodeMap atts = node.getAttributes();
      String queueName = atts.getNamedItem(NAME_ATTR).getNodeValue();
      String selectorString = null;
      boolean durable = XMLConfigurationUtil.getBoolean(e, "durable",
DEFAULT_QUEUE_DURABILITY);
      NodeList children = node.getChildNodes();
      for (int i = 0; i < children.getLength(); i++) {
         Node child = children.item(i);

         if
(QUEUE_SELECTOR_NODE_NAME.equals(children.item(i).getNodeName())) {
            Node selectorNode = children.item(i);
            Node attNode =
selectorNode.getAttributes().getNamedItem("string");
            selectorString = attNode.getNodeValue();
         }
      }

      return newQueue(queueName, selectorString, durable);
   }

How should this now be done?

thanks, Mitchell



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/EmbeddedJMS-doesn-t-register-JMS-topics-or-queues-tp4716605.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to