我正在尝试使用proton-j library
创建一个与天蓝色服务总线对话的Android应用程序当我尝试在我的android项目中添加proton-j-0.11.1 jar文件作为库时。 尝试发送到天蓝色的服务总线,但最终有一个例外,破坏EPIPe破坏:
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
我的代码在这里:
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();