Stomp-Perl: Fix+Functionality Patch

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Stomp-Perl: Fix+Functionality Patch

David Jones
Hi,
 
We have been using the Stomp-Perl modules and found a few problems (we realise it is Alpha-quality code).
 
Fixes:
 
We were having issues with the connection not being closed on the ActiveMQ side. That is, a connection was being opened when our client app needed to send a message. Once the client app died, it sent a Disconnect() as required and exited normally. The server side was still open so we looked into it.
 
Fix 1: A timeout parameter was added to IO::Socket::Inet in order that connections closed if client crashed out with disconnecting properly.
Fix 2: The message parameter in Stomp::Connection::Disconnect() was incrorrectly in Capital Case instead of uppercase.
 
Updates:
 
We needed to be able to add custom headers to a message. So a method, Stomp::Connection::SendWithHeaders($queue, $body, $params, $receipt) has been added. $params is a hashref to additional header entries which will appear in the message. Usage is like:
 
my $params = { 'foo' => 'bar' };
$con->SendWithHeaders( $queue, $body, $receipt, $params);
 
 
 
 
The website stomp.codehaus.org is flaky at best, the 'Contributing' page returns 404/502.. Does anyone else have problems?
 
Thanks,
David

_______________________________
David Jones
Software Engineer
IngentaConnect
[hidden email]

www.ingentaconnect.com
_______________________________

 

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Connection.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Stomp-Perl: Fix+Functionality Patch

David Jones
Okay attachments don't work, so I'm pasting the patch file here:
 
 
 
43c43
<     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1 );
---
>     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1, Timeout => 60 );
126a127
>
146c147
<     $self->_transmit( "Disconnect", { session=> $self->{"session"} });
---
>     $self->_transmit( "DISCONNECT", { session=> $self->{"session"} });
186,193c187,203
< sub Send($$$)
< {
<     my $self=shift;
<     my $queue = shift;
<     my $body = shift;
<     my $rcpt = shift;
<
<     $self->_transmit( "SEND", { session=> $self->{"session"}, destination=> $queue, receipt=>$rcpt }, $body);
---

> sub Send($$$;$) {
>       my $self   = shift;
>       my $queue  = shift;
>       my $body   = shift;
>       my $rcpt   = shift;
>       my $params = shift || {};
>
>       $self->_transmit(
>               "SEND",
>               {
>                       session     => $self->{"session"},
>                       destination => $queue,
>                       receipt     => $rcpt,
>                       %$params,
>               },
>               $body,
>       );
194a205,206
>
>
 
 
usage: patch Connection.pm Connection.patch
 
Thanks,
David
 

_______________________________
David Jones
Software Engineer
IngentaConnect
[hidden email]
www.ingentaconnect.com
_______________________________

 
-----Original Message-----
From: David Jones [mailto:[hidden email]]
Sent: 21 September 2006 5:00 pm
To: [hidden email]
Subject: [stomp-dev] Stomp-Perl: Fix+Functionality Patch

Hi,
 
We have been using the Stomp-Perl modules and found a few problems (we realise it is Alpha-quality code).
 
Fixes:
 
We were having issues with the connection not being closed on the ActiveMQ side. That is, a connection was being opened when our client app needed to send a message. Once the client app died, it sent a Disconnect() as required and exited normally. The server side was still open so we looked into it.
 
Fix 1: A timeout parameter was added to IO::Socket::Inet in order that connections closed if client crashed out with disconnecting properly.
Fix 2: The message parameter in Stomp::Connection::Disconnect() was incrorrectly in Capital Case instead of uppercase.
 
Updates:
 
We needed to be able to add custom headers to a message. So a method, Stomp::Connection::SendWithHeaders($queue, $body, $params, $receipt) has been added. $params is a hashref to additional header entries which will appear in the message. Usage is like:
 
my $params = { 'foo' => 'bar' };
$con->SendWithHeaders( $queue, $body, $receipt, $params);
 
 
 
 
The website stomp.codehaus.org is flaky at best, the 'Contributing' page returns 404/502.. Does anyone else have problems?
 
Thanks,
David

_______________________________
David Jones
Software Engineer
IngentaConnect
[hidden email]

www.ingentaconnect.com
_______________________________

 
Reply | Threaded
Open this post in threaded view
|

RE: Stomp-Perl: Fix+Functionality Patch

David Jones
Argh! Too much haste, blame Thursday afternoons and too much coffee..

- I removed the sub SendWithHeaders as I decided that it was uneccesary to have an additional method in the package.
- Stomp::Connection::Send($$$) has been altered to include an additional parameter, $params. This is the aforementioned hashref which will add custom headers to the message.
 
Usage:
 
my $params = { 'foo' => 'bar' };
$con->Send( $queue, $body, $receipt, $params);
 
The resulting message will contain the extra headers that were specified. $params is totally optional, so you can continue using Send without changing existing code.
 
 
 
Sorry if there's been any confusion here : |
 
 
~David
 
 
-----Original Message-----
From: David Jones [mailto:[hidden email]]
Sent: 21 September 2006 5:03 pm
To: [hidden email]
Subject: RE: [stomp-dev] Stomp-Perl: Fix+Functionality Patch

Okay attachments don't work, so I'm pasting the patch file here:
 
 
 
43c43
<     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1 );
---
>     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1, Timeout => 60 );
126a127
>
146c147
<     $self->_transmit( "Disconnect", { session=> $self->{"session"} });
---
>     $self->_transmit( "DISCONNECT", { session=> $self->{"session"} });
186,193c187,203
< sub Send($$$)
< {
<     my $self=shift;
<     my $queue = shift;
<     my $body = shift;
<     my $rcpt = shift;
<
<     $self->_transmit( "SEND", { session=> $self->{"session"}, destination=> $queue, receipt=>$rcpt }, $body);
---

> sub Send($$$;$) {
>       my $self   = shift;
>       my $queue  = shift;
>       my $body   = shift;
>       my $rcpt   = shift;
>       my $params = shift || {};
>
>       $self->_transmit(
>               "SEND",
>               {
>                       session     => $self->{"session"},
>                       destination => $queue,
>                       receipt     => $rcpt,
>                       %$params,
>               },
>               $body,
>       );
194a205,206
>
>
 
 
usage: patch Connection.pm Connection.patch
 
Thanks,
David
 

_______________________________
David Jones
Software Engineer
IngentaConnect
[hidden email]
www.ingentaconnect.com
_______________________________

 
-----Original Message-----
From: David Jones [mailto:[hidden email]]
Sent: 21 September 2006 5:00 pm
To: [hidden email]
Subject: [stomp-dev] Stomp-Perl: Fix+Functionality Patch

Hi,
 
We have been using the Stomp-Perl modules and found a few problems (we realise it is Alpha-quality code).
 
Fixes:
 
We were having issues with the connection not being closed on the ActiveMQ side. That is, a connection was being opened when our client app needed to send a message. Once the client app died, it sent a Disconnect() as required and exited normally. The server side was still open so we looked into it.
 
Fix 1: A timeout parameter was added to IO::Socket::Inet in order that connections closed if client crashed out with disconnecting properly.
Fix 2: The message parameter in Stomp::Connection::Disconnect() was incrorrectly in Capital Case instead of uppercase.
 
Updates:
 
We needed to be able to add custom headers to a message. So a method, Stomp::Connection::SendWithHeaders($queue, $body, $params, $receipt) has been added. $params is a hashref to additional header entries which will appear in the message. Usage is like:
 
my $params = { 'foo' => 'bar' };
$con->SendWithHeaders( $queue, $body, $receipt, $params);
 
 
 
 
The website stomp.codehaus.org is flaky at best, the 'Contributing' page returns 404/502.. Does anyone else have problems?
 
Thanks,
David

_______________________________
David Jones
Software Engineer
IngentaConnect
[hidden email]

www.ingentaconnect.com
_______________________________

 
Reply | Threaded
Open this post in threaded view
|

Re: Stomp-Perl: Fix+Functionality Patch

Alan Willis
In reply to this post by David Jones
Re: [stomp-dev] Stomp-Perl: Fix+Functionality Patch

I've also done work on a separate stomp-perl interface. While it too is alpha quality, it also supports transactions, and I intend to actively maintain it.

Waiting to hear from my employer to see if I can release it.
-alan


-----Original Message-----
From: David Jones <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Thu Sep 21 09:13:04 2006
Subject: RE: [stomp-dev] Stomp-Perl: Fix+Functionality Patch

Argh! Too much haste, blame Thursday afternoons and too much coffee..

- I removed the sub SendWithHeaders as I decided that it was uneccesary to have an additional method in the package.
- Stomp::Connection::Send($$$) has been altered to include an additional parameter, $params. This is the aforementioned hashref which will add custom headers to the message.

Usage:

my $params = { 'foo' => 'bar' };
$con->Send( $queue, $body, $receipt, $params);

The resulting message will contain the extra headers that were specified. $params is totally optional, so you can continue using Send without changing existing code.



Sorry if there's been any confusion here : |


~David



-----Original Message-----
From: David Jones [[hidden email]]
Sent: 21 September 2006 5:03 pm
To: [hidden email]
Subject: RE: [stomp-dev] Stomp-Perl: Fix+Functionality Patch


Okay attachments don't work, so I'm pasting the patch file here:



43c43
<     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1 );
---
>     my $socket = IO::Socket::INET->new( PeerAddr=> $self->{"host"}, PeerPort=> $self->{"port"}, Proto=>"tcp", Blocking =>1, Timeout => 60 );
126a127
>
146c147
<     $self->_transmit( "Disconnect", { session=> $self->{"session"} });
---
>     $self->_transmit( "DISCONNECT", { session=> $self->{"session"} });
186,193c187,203
< sub Send($$$)
< {
<     my $self=shift;
<     my $queue = shift;
<     my $body = shift;
<     my $rcpt = shift;
<
<     $self->_transmit( "SEND", { session=> $self->{"session"}, destination=> $queue, receipt=>$rcpt }, $body);
---
> sub Send($$$;$) {
>       my $self   = shift;
>       my $queue  = shift;
>       my $body   = shift;
>       my $rcpt   = shift;
>       my $params = shift || {};
>
>       $self->_transmit(
>               "SEND",
>               {
>                       session     => $self->{"session"},
>                       destination => $queue,
>                       receipt     => $rcpt,
>                       %$params,
>               },
>               $body,
>       );
194a205,206
>
>


usage: patch Connection.pm Connection.patch

Thanks,
David

_______________________________
David Jones
Software Engineer
IngentaConnect
 <[hidden email]> [hidden email]
 <http://www.ingentaconnect.com/> www.ingentaconnect.com
_______________________________




-----Original Message-----
From: David Jones [[hidden email]]
Sent: 21 September 2006 5:00 pm
To: [hidden email]
Subject: [stomp-dev] Stomp-Perl: Fix+Functionality Patch


Hi,

We have been using the Stomp-Perl modules and found a few problems (we realise it is Alpha-quality code).

Fixes:

We were having issues with the connection not being closed on the ActiveMQ side. That is, a connection was being opened when our client app needed to send a message. Once the client app died, it sent a Disconnect() as required and exited normally. The server side was still open so we looked into it.

Fix 1: A timeout parameter was added to IO::Socket::Inet in order that connections closed if client crashed out with disconnecting properly.
Fix 2: The message parameter in Stomp::Connection::Disconnect() was incrorrectly in Capital Case instead of uppercase.

Updates:

We needed to be able to add custom headers to a message. So a method, Stomp::Connection::SendWithHeaders($queue, $body, $params, $receipt) has been added. $params is a hashref to additional header entries which will appear in the message. Usage is like:

my $params = { 'foo' => 'bar' };
$con->SendWithHeaders( $queue, $body, $receipt, $params);




The website stomp.codehaus.org is flaky at best, the 'Contributing' page returns 404/502.. Does anyone else have problems?

Thanks,
David

_______________________________
David Jones
Software Engineer
IngentaConnect
 <[hidden email]> [hidden email]
 <http://www.ingentaconnect.com/> www.ingentaconnect.com
_______________________________