perl生成器连接到activemq服务器时出错

时间:2012-12-05 11:26:59

标签: perl activemq eof stomp producer

我正在尝试与perl制作人交谈ActiveMq。请找到我尝试过的代码。它给了我一个错误“* Net :: STOMP :: Client :: IO :: receive_data():不能sysread():EOF”**

调试后错误发生在$stomp->connect(); 请让我知道为什么这个错误...我无法在网上找到这方面的帮助..

提前致谢

我试图telnet到我想要连接的网址。首先它是连接的,最后是一些错误信息,如下所示:

CacheEnabledSizePrefixDisabled MaxInactivityDurationInitalDelay'TcpNoDelayEnabledMaxInactivityDurationu0TightEncodingEnabledStackTraceEnabledPuTTY
Connection closed by foreign host.

这表示连接已关闭。

这些是代理日志,我怀疑有些错误:

2012-12-07 14:44:12,021 | WARN  | Transport Connection to: tcp://127.0.0.1:57404 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///127.0.0.1:57404@61616
2012-12-07 14:44:12,021 | WARN  | Transport Connection to: tcp://127.0.0.1:57403 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///127.0.0.1:57403@61616
2012-12-07 14:44:12,024 | WARN  | Transport Connection to: tcp://127.0.0.1:57405 failed: java.io.IOException: Unknown data type: 47 | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///127.0.0.1:57405@61616
2012-12-07 14:44:12,024 | WARN  | Transport Connection to: tcp://127.0.0.1:57405 failed: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: tcp://127.0.0.1:57405 | org.apache.activemq.broker.TransportConnection.Transport | Async Exception Handler
2012-12-07 16:08:55,045 | WARN  | Transport Connection to: tcp://127.0.0.1:58008 failed: java.io.IOException: Unknown data type: 69 | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///127.0.0.1:58008@61616
2012-12-07 16:08:55,045 | WARN  | Transport Connection to: tcp://127.0.0.1:58008 failed: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: tcp://127.0.0.1:58008 | org.apache.activemq.broker.TransportConnection.Transport | Async Exception Handler

代码:

#! /usr/bin/perl

use strict;
use warnings;

use Net::STOMP::Client;
my $stomp = Net::STOMP::Client->new(uri => "tcp://$url:$port");
my $peer = $stomp->peer();
  printf("connected to broker %s (IP %s), port %d\n",
      $peer->host(), $peer->addr(), $peer->port());
  $stomp->connect();
  printf("speaking STOMP %s with server %s\n",
      $stomp->version(), $stomp->server() || "UNKNOWN");
  printf("session %s started\n", $stomp->session());
  $stomp->disconnect();
  printf("session ended\n");

1 个答案:

答案 0 :(得分:0)

如果您告诉我们错误发生在哪一行,那会有所帮助,因为这会指出哪个调用失败了该错误。

Perl的STOMP库有一些非常错误的版本。确保您使用的是CPAN的最新版本,而不是系统上预装的旧版本。