Tibco::Rv::Cm::Msg - Tibco certified message object


Tibco-Rv documentation Contained in the Tibco-Rv distribution.

Index


Code Index:

NAME

Top

Tibco::Rv::Cm::Msg - Tibco certified message object

SYNOPSIS

Top

   $rv->createCmListener( ..., callback => sub
   {
      my ( $msg ) = @_;
      print "Listener got a message: $msg, from sender: ", $msg->CMSender,
      ', sequence: ', $msg->CMSequence, "\n";
   } );

DESCRIPTION

Top

Tibco certified message-manipulating class. It is a subclass of Tibco::Rv::Msg, so Msg methods are available to certified messages. Additionally, methods specific to certified messaging (CMSender, CMSequence, and CMTimeLimit) are available.

CONSTRUCTOR

Top

$msg = new Tibco::Rv::Cm::Msg( %args )
   %args:
      sendSubject => $sendSubject,
      replySubject => $replySubject,
      CMTimeLimit => $CMTimeLimit,
      $fieldName1 => $stringValue1,
      $fieldName2 => $stringValue2, ...

Creates a Tibco::Rv::Cm::Msg, with sendSubject, replySubject, and CMTimeLimit as given in %args (these three values default to undef if not specified). Any other name => value pairs are added as string fields.

METHODS

Top

$CMSender = $msg->CMSender

Returns the CMSender that sent $msg. If $msg was not sent from a certified messaging sender, undef is returned.

$CMSequence = $msg->CMSequence

Returns the sequence number if $msg was sent from a certified messaging sender, and if the listener is registered for certified delivery. Otherwise, undef is returned.

See your TIB/Rendezvous documentation for more information on CMSender and CMSequence.

$CMTimeLimit = $msg->CMTimeLimit

Returns the certified messaging time limit for $msg, after which the sender no longer certifies delivery. A return value of 0 represents no time limit.

$msg->CMTimeLimit( $CMTimeLimit )

Sets the certified messaging time limit for $msg, after which the sender no longer certifies delivery. If no time limit is set, the value set by Tibco::Rv::Cm::Transport::setDefaultCMTimeLimit is used. If setDefaultCMTimeLimit was not called, 0 is used (no time limit).

SEE ALSO

Top

Tibco::Rv::Msg

AUTHOR

Top

Paul Sturm <sturm@branewave.com>


Tibco-Rv documentation Contained in the Tibco-Rv distribution.

package Tibco::Rv::Cm::Msg;
use base qw/ Tibco::Rv::Msg /;


use vars qw/ $VERSION @CARP_NOT /;
$VERSION = '1.02';


@CARP_NOT = qw/ Tibco::Rv::Msg /;


my ( %defaults );
BEGIN
{
   %defaults = ( CMTimeLimit => undef );
}


sub new
{
   my ( $proto ) = shift;
   my ( %params ) = ( CMSender => undef, CMSequence => undef, %defaults );
   my ( %args ) = @_;
   foreach my $field ( keys %defaults )
   {
      next unless ( exists $args{$field} );
      $params{$field} = $args{$field};
      delete $args{$field};
   }
   my ( $self ) = $proto->SUPER::new( %args );

   @$self{ keys %params } = ( values %params );
   $self->CMTimeLimit( $params{CMTimeLimit} )
      if ( defined $params{CMTimeLimit} );

   return $self;
}


sub _adopt
{
   my ( $proto, $id ) = @_;
   my ( $self ) = $proto->SUPER::_adopt( $id );
   @$self{ qw/ CMSender CMSequence /, keys %defaults } =
      ( undef, undef, values %defaults );
   $self->_getCMValues;
   return $self;
}


sub _getCMValues
{
   my ( $self ) = @_;
   Tibco::Rv::Msg::Msg_GetCMValues(
      @$self{ qw/ id CMSender CMSequence CMTimeLimit / } );
}


sub CMSender { return shift->{CMSender} }
sub CMSequence { return shift->{CMSequence} }


sub CMTimeLimit
{
   my ( $self ) = shift;
   return @_ ? $self->_setCMTimeLimit( @_ ) : $self->{CMTimeLimit};
}


sub _setCMTimeLimit
{
   my ( $self, $CMTimeLimit ) = @_;
   my ( $status ) =
      Tibco::Rv::Msg::tibrvMsg_SetCMTimeLimit( $self->{id}, $CMTimeLimit );
   Tibco::Rv::die( $status ) unless ( $status == Tibco::Rv::OK );
   return $self->{CMTimeLimit} = $CMTimeLimit;
}


1;