1

EventHub から送受信する最初のアプリを作成しています。Azure docで提供されている例に従っています。

私の servicebus.properties ファイルは次のようになります。

connectionfactory.SBCF = amqps://SendRule:BLAH..blah@mynamespace.servicebus.windows.net/?sync-publish=false
queue.EventHub = eventhub1

私の送信者コードは次のようになります

    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(Context.PROVIDER_URL, "servicebus.properties");
    Context context = new InitialContext(env);

    ConnectionFactory cf = (ConnectionFactory) context.lookup("SBCF");
    Destination queue = (Destination) context.lookup("EventHub");
    Connection connection = cf.createConnection();
    Session sendSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer sender = sendSession.createProducer(queue);

例外が発生しています

Exception in thread "main" javax.jms.JMSException: Peer did not create remote endpoint for link, target: eventhub1
    at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.<init>(MessageProducerImpl.java:69)
    at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:293)
    at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:57)
    at com.commvault.azure.Sender.main(Sender.java:39)

解決策をグーグルで検索すると、ServiceBus Queues に関するヘルプが表示され、使用される接続文字列の形式は [ユーザー名]:[パスワード]:[名前空間] です。EventHub でヘルプが見つかりません。

何が欠けているのですか?

4

0 に答える 0