使用Net :: STOMP :: Client连接到Tibco JMS主题时无法sysread():EOF错误

时间:2016-02-10 10:10:37

标签: perl jms stomp tibco tibco-ems

我正在使用Net::STOMP::Client模块连接到非我托管的Tibco JMS主题服务器。

我正在尝试SSL方法,我有一个certificate.p12文件,我从中创建了cert.pem& key.pem并将其传递给Net::Stomp::Client。我使用Authen::Credential::x509模块进行基于证书的身份验证。

现在,当我尝试运行perl脚本时,我收到以下错误:

DEBUG: .../IO/Socket/SSL.pm:605: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:607: socket connected
DEBUG: .../IO/Socket/SSL.pm:629: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:662: using SNI with hostname mmx-nprd3-07.cisco.com
DEBUG: .../IO/Socket/SSL.pm:697: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:787: ssl handshake done
# 2016/02/10-07:18:33 JmsClient.pl[6618]: connect to stomp+ssl://mmx-ntard-07.sammy.com:7222 ok: 160.**.1**.**2

Stomp Client Object Created

Connected to broker mmx-ntard-07.sammy.com (IP 1**.*8.**.**2), port 7222

# 2016/02/10-07:18:33 JmsClient.pl[6618]: Net::STOMP::Client=HASH(0x194df00)->connect()
# 2016/02/10-07:18:33 JmsClient.pl[6618]: encoding CONNECT frame
# 2016/02/10-07:18:33 JmsClient.pl[6618]:  H accept-version:1.0,1.1,1.2
# 2016/02/10-07:18:33 JmsClient.pl[6618]:  H host:mmx-ntard-07.sammy.com
# 2016/02/10-07:18:33 JmsClient.pl[6618]: sent 65 bytes
# 2016/02/10-07:18:33 JmsClient.pl[6618]: received 12 bytes
# 2016/02/10-07:18:34 JmsClient.pl[6618]: received 0 bytes
cannot sysread(): EOF

以下是perl脚本: -

use Net::STOMP::Client;
use No::Worries::Log qw(*);
use IO::Socket::SSL;
use FindBin qw($Bin);
use Authen::Credential::x509;

$IO::Socket::SSL::DEBUG = 2;

 log_filter("debug");

 my $auth = Authen::Credential::x509->new(
    # client certificate to present
    cert => "$Bin/JmsCertificate/aix_jms_public_Cert.pem",
    # # client private key
    key  => "$Bin/JmsCertificate/aix_jms_private_Key.pem",
    pass => 'password'
 );

 my $stomp = Net::STOMP::Client->new(
    uri   => "stomp+ssl://mmx-ntard-07.sammy.com:7222",
      auth  => $auth,
      debug => 'all',
  );

  print "\nStomp Client Object Created";
  my $peer = $stomp->peer();
  printf("\nConnected to broker %s (IP %s), port %d\n", $peer->host(), $peer->addr(), $peer->port());

  $stomp->connect();

  print "\nConnected\n";

  my $sid = $stomp->uuid();
  $stomp->subscribe(
      destination => "/queue/test",
      # we use the generated subscription id
      id          => $sid,
      # we want a receipt on our SUBSCRIBE frame
      receipt     => $stomp->uuid(),
  );
  my $count = 0;
  my $frame;

  while ($count < 10) {
      $frame = $stomp->wait_for_frames(timeout => 1);
      if ($frame) {
          if ($frame->command() eq "MESSAGE") {
              $count++;
              printf("received message %d with id %s\n",
                     $count, $frame->header("message-id"));
          } else {
              # this will catch the RECEIPT frame
              printf("%s frame received\n", $frame->command());
          }
      } else {
          print("waiting for messages...\n");
      }
  }
  $stomp->unsubscribe(id => $sid);
  $stomp->disconnect();

我无法弄清楚这里发生了什么。我也看到了其他一些帖子,但它们都是针对ActiveMQ的。我不确定这是否会有所作为。

0 个答案:

没有答案