我正在尝试将 EMS 消息从 Perl 发送到 EMS 服务器中运行的队列。我正在使用 STOMP 模块连接到 EMS 队列以发送消息。这是我的代码 -
JMSQUEUE.pl:
use Net::Stomp;
use Net::Stomp::Frame;
my $stomp = Net::Stomp->new( { hostname => 'localhost', port => '7222' } );
$stomp->connect( { login => 'admin', passcode => '' } );
$stomp->send( { destination => '/queue/pradeepexp', body => 'test message' } );
$stomp->disconnect;
在我的模块中 - STOMP.PM:
sub connect {
my ( $self, $conf ) = @_;
my $frame =
Net::Stomp::Frame->new( { command => 'CONNECT', headers => $conf } );
$self->send_frame($frame);
$frame = $self->receive_frame;
# Setting initial values for session id, as given from
# the stomp server
$self->session_id( $frame->headers->{session} );
$self->_connect_headers($conf);
return $frame;
}
在调用connect之前我需要做任何设置吗?