Trying to communicate with azure service bus from

2019-07-17 19:45发布

I am trying to make an android app to talk to azure service bus using proton-j library

When I try to add proton-j-0.11.1 jar file as library on my android project. Try to send to azure service bus but end up with an exception Broken EPIPe broken:

01-15 19:37:02.165: E/proton.messenger(822): Error processing connection
01-15 19:37:02.165: E/proton.messenger(822): java.net.SocketException: sendto failed: EPIPE (Broken pipe)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.IoBridge.sendto(IoBridge.java:489)
01-15 19:37:02.165: E/proton.messenger(822):    at java.nio.SocketChannelImpl.writeImpl(SocketChannelImpl.java:378)
01-15 19:37:02.165: E/proton.messenger(822):    at java.nio.SocketChannelImpl.write(SocketChannelImpl.java:336)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.driver.impl.ConnectorImpl.write(ConnectorImpl.java:168)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.driver.impl.ConnectorImpl.process(ConnectorImpl.java:101)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.messenger.impl.MessengerImpl.processActive(MessengerImpl.java:738)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:895)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:844)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.messenger.impl.MessengerImpl.send(MessengerImpl.java:417)
01-15 19:37:02.165: E/proton.messenger(822):    at org.apache.qpid.proton.messenger.impl.MessengerImpl.send(MessengerImpl.java:394)
01-15 19:37:02.165: E/proton.messenger(822):    at com.example.qpidprotonj.MainActivity$1$1.run(MainActivity.java:80)
01-15 19:37:02.165: E/proton.messenger(822):    at java.lang.Thread.run(Thread.java:856)
01-15 19:37:02.165: E/proton.messenger(822): Caused by: libcore.io.ErrnoException: sendto failed: EPIPE (Broken pipe)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.Posix.sendtoBytes(Native Method)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.Posix.sendto(Posix.java:146)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:169)
01-15 19:37:02.165: E/proton.messenger(822):    at libcore.io.IoBridge.sendto(IoBridge.java:487)
01-15 19:37:02.165: E/proton.messenger(822):    ... 11 more
01-15 19:37:02.165: E/proton.messenger(822): Timeout when waiting for condition org.apache.qpid.proton.messenger.impl.MessengerImpl$SentSettled@40d08550 after 3000 ms

My code is here:

if (messenger.stopped())
        messenger.start();

Log.d(tag, "Create message");
Message message = Message.Factory.create();

Log.d(tag, "Setting address");
message.setAddress("amqps://<key_name>:<key_value>@tttesting.servicebus.windows.net/topic1");

Log.d(tag, "Setting subject");
message.setSubject("sujet 1");

Log.d(tag, "Setting AMQP body");
message.setBody(new AmqpValue(editText.getText().toString()));

Log.d(tag, "Put message");
messenger.put(message);

final Tracker tracker = messenger.outgoingTracker();

Log.d(tag, "Sending >>>>>>");
messenger.send();

0条回答
登录 后发表回答