Thanks, I have updated the source but still get the same error.

javax.jms.InvalidDestinationException: The messaging entity
'my-namespace:topic:test.topic~15|test1' could not be found.
TrackingId:12ecc2a3-f8f3-42a3-8bd5-ad5d9823c367_B20,
SystemTracker:my-namespace:topic:test.topic~15|test1, Timestamp:8/8/2017
7:15:35 AM TrackingId:5166f39a3069426ab4ee0ef86f084db6_G31,
SystemTracker:gateway6, Timestamp:8/8/2017 7:15:36 AM [condition =
amqp:not-found]
at
org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:150)
at
org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:117)
at
org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder.handleClosed(AmqpResourceBuilder.java:185)
at
org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder.processRemoteClose(AmqpResourceBuilder.java:129)
at
org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:905)
at
org.apache.qpid.jms.provider.amqp.AmqpProvider.access$1900(AmqpProvider.java:93)
at
org.apache.qpid.jms.provider.amqp.AmqpProvider$18.run(AmqpProvider.java:791)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)


Any suggestions?

*Updated source:*

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Hashtable;

import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.Context;
import javax.naming.InitialContext;

public class AmqpJmsSubscriberApp {
    private Connection connection;
    private Session subscriberSession;
    private MessageConsumer subscriber;

    public AmqpJmsSubscriberApp() throws Exception {
        Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.qpid.jms.jndi.JmsInitialContextFactory");

        //amqp://hostname:port[?option=value[&option2=value...]]
        env.put("connectionfactory.SBCF", "amqps://
my-namespace.servicebus.windows.net:5671?jms.clientID=tester&amqp.idleTimeout=120000
");
        env.put("topic.TOPIC", "test.topic");

        Context context = new InitialContext(env);

        ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("SBCF");
        Topic topic = (Topic) context.lookup("TOPIC");

        connection = connectionFactory.createConnection("my-user",
"my-secret-key");

        subscriberSession = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
        subscriber = subscriberSession.createDurableSubscriber(topic,
"test1");

        MessageListener messagelistener = new MessageListener()
        {
           public void onMessage(Message message)
           {
               try {
              BytesMessage byteMsg = (BytesMessage)message;

              byte[] byteArr = new byte[(int)byteMsg.getBodyLength()];
              byteMsg.readBytes(byteArr);
              String msg = new String(byteArr);

                   System.out.println("Received message with JMSMessageID =
" + message.getJMSMessageID());
                   System.out.println("You said " + msg);
                   message.acknowledge();
               } catch (Exception e) {
                   e.printStackTrace();
               }
           }
        };

        subscriber.setMessageListener( messagelistener );
        connection.start();
    }

    public static void main(String[] args) {
        try {
        AmqpJmsSubscriberApp simpleSubscriber = new AmqpJmsSubscriberApp();
            System.out.println("Press [enter] to send a message. Type
'exit' + [enter] to quit.");
            BufferedReader commandLine = new java.io.BufferedReader(new
InputStreamReader(System.in));

            while (true) {
                String s = commandLine.readLine();
                if (s.equalsIgnoreCase("exit")) {
                simpleSubscriber.close();
                    System.exit(0);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void close() throws JMSException {
        connection.close();
    }
}



/ Joacim


On Mon, Aug 7, 2017 at 3:34 PM, Timothy Bish <tabish...@gmail.com> wrote:

> On 08/07/2017 09:26 AM, 4 Integration wrote:
>
>> Hi,
>>
>> Testing QPid JMS (AMQP v1.0) with Azure Service Bus (SB).
>>
>> Trying to get durable subscriptions to work.
>> I have created a topic in SB
>>
>> When starting my test app I get:
>>
>> javax.jms.JMSException: The messaging entity
>> 'mynamespace:topic:test.topic~15|test1' could not be found.
>> TrackingId:12ecc2a3-f8f3-42a3-8bd5-ad5d9823c367_B20,
>> SystemTracker:jjarkebo:topic:test.topic~15|test1, Timestamp:8/7/2017
>> 1:23:34 PM TrackingId:b1af76b2b7a44b95ad2bd0e01f406507_G20,
>> SystemTracker:gateway6, Timestamp:8/7/2017 1:23:34 PM
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.TopicSubscriberImpl.create
>> ClientReceiver(TopicSubscriberImpl.java:111)
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.MessageConsumerImpl.<init>
>> (MessageConsumerImpl.java:129)
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.TopicSubscriberImpl.<init>
>> (TopicSubscriberImpl.java:46)
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createDurableS
>> ubscriber(SessionImpl.java:544)
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createDurableS
>> ubscriber(SessionImpl.java:512)
>> at
>> org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createDurableS
>> ubscriber(SessionImpl.java:59)
>> at com.vcrs.test.AmqpJmsSubscriberApp.<init>(AmqpJmsSubscriberA
>> pp.java:39)
>> at com.vcrs.test.AmqpJmsSubscriberApp.main(AmqpJmsSubscriberApp.java:67)
>>
>> Any ideas why this happen?
>> Do you have a working example?
>>
>> My test app code below
>>
>> import javax.jms.*;
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>>
>> import org.apache.qpid.amqp_1_0.jms.Connection;
>> import org.apache.qpid.amqp_1_0.jms.ConnectionFactory;
>> import org.apache.qpid.amqp_1_0.jms.Destination;
>> import org.apache.qpid.amqp_1_0.jms.MessageConsumer;
>> import org.apache.qpid.amqp_1_0.jms.MessageProducer;
>> import org.apache.qpid.amqp_1_0.jms.Session;
>>
>> import java.io.BufferedReader;
>> import java.io.InputStreamReader;
>> import java.util.Hashtable;
>> import java.util.Random;
>>
>> public class AmqpJmsSubscriberApp {
>>      private Connection connection;
>>      private Session subscriberSession;
>>      private MessageConsumer subscriber;
>>
>>      public AmqpJmsSubscriberApp() throws Exception {
>>          Hashtable<String, String> env = new Hashtable<String, String>();
>>          env.put(Context.INITIAL_CONTEXT_FACTORY,
>> "org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory");
>>
>>          env.put("connectionfactory.SBCF", "amqps://
>> MyUser:mysecret...@mynamespace.servicebus.windows.net:5671");
>>          env.put("topic.TOPIC", "test.topic");
>>
>>          Context context = new InitialContext(env);
>>
>>          ConnectionFactory cf = (ConnectionFactory)
>> context.lookup("SBCF");
>>          Topic topic = (Topic) context.lookup("TOPIC");
>>
>>          connection = cf.createConnection();
>>
>>          subscriberSession = connection.createSession(false,
>> Session.CLIENT_ACKNOWLEDGE);
>>          subscriber = subscriberSession.createDurableSubscriber(topic,
>> "test1");
>>
>>          MessageListener messagelistener = new MessageListener()
>>          {
>>             public void onMessage(Message message)
>>             {
>>                 try {
>>                BytesMessage byteMsg = (BytesMessage)message;
>>
>>                byte[] byteArr = new byte[(int)byteMsg.getBodyLength()];
>>                byteMsg.readBytes(byteArr);
>>                String msg = new String(byteArr);
>>
>>                     System.out.println("Received message with
>> JMSMessageID =
>> " + message.getJMSMessageID());
>>                     System.out.println("You said " + msg);
>>                     message.acknowledge();
>>                 } catch (Exception e) {
>>                     e.printStackTrace();
>>                 }
>>             }
>>          };
>>
>>          subscriber.setMessageListener( messagelistener );
>>          connection.start();
>>      }
>>
>>      public static void main(String[] args) {
>>          try {
>>          AmqpJmsSubscriberApp simpleSubscriber = new
>> AmqpJmsSubscriberApp();
>>              System.out.println("Press [enter] to send a message. Type
>> 'exit' + [enter] to quit.");
>>              BufferedReader commandLine = new java.io.BufferedReader(new
>> InputStreamReader(System.in));
>>
>>              while (true) {
>>                  String s = commandLine.readLine();
>>                  if (s.equalsIgnoreCase("exit")) {
>>                  simpleSubscriber.close();
>>                      System.exit(0);
>>                  }
>>              }
>>          } catch (Exception e) {
>>              e.printStackTrace();
>>          }
>>      }
>>
>>      public void close() throws JMSException {
>>          connection.close();
>>      }
>> }
>>
>> From the packages you're importing you are not using Qpid JMS but are
> using the legacy AMQP 1.0 JMS client which has not been supported in quite
> some time.  You need to use the Qpid JMS client as documented here:
> http://qpid.apache.org/components/jms/index.html
>
> --
> Tim Bish
> twitter: @tabish121
> blog: http://timbish.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> For additional commands, e-mail: users-h...@qpid.apache.org
>
>

Reply via email to