blib/lib/XAS/Lib/Stomp/Utils.pm

filter: Statementstmt 7.0% 11 / 156 Branchbran 0.0% 0 / 78 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 18.7% 3 / 16 Podpod 100% 12 / 12 totaltotal 9.7% 26 / 267 CC 42 SCAR 35.2
CC
42
Cov
5%
unsubscribe
72.0
nack
56.0
stomp
42.0
CRAP 33.7
« blib/lib/XAS/Lib/SSH/Client/Shell.pm ↑ Summary blib/lib/XAS/Lib/Process/Unix.pm »
1 package XAS::Lib::Stomp::Utils;
2  
3 1 our $VERSION = '0.02';
4  
5 1 ▶use XAS::Lib::Stomp::Frame;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 use XAS::Class
8 1 debug => 0,
9 version => $VERSION,
10 base => 'XAS::Base',
11 1 ▶;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 #use Data::Dumper;
14  
15 # -----------------------------------------------------------
16 # Public Methods
17 # -----------------------------------------------------------
18  
19 sub connect {
20 0 ▶ my $self = shift;
Subroutine connect: not called CC=4 SCAR=30.0
Pod documented
21 0 my $p = $self->validate_params(\@_, {
22 -login => { optional => 1, default => undef },
23 -passcode => { optional => 1, default => undef },
24 -host => { optional => 1, default => 'localhost' },
25 -heart_beat => { optional => 1, default => '0,0', regex => qr/\d+,\d+/ },
26 -acceptable => { optional => 1, default => '1.0,1.1,1.2',
27 callbacks => {
28 'valid target' => \&_match
29 }
30 }
31 });
32  
33 0 my $frame;
34 0 my $header = {};
35  
36 0 ▶ $header->{'login'} = $p->{'login'} if (defined($p->{'login'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"login"} 0 0 0
37 0 ▶ $header->{'passcode'} = $p->{'passcode'} if (defined($p->{'passcode'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"passcode"} 0 0 0
38  
39 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
40  
41 0 $header->{'host'} = $p->{'host'};
42 0 $header->{'heart-beat'} = $p->{'heart_beat'};
43 0 $header->{'accept-version'} = $p->{'acceptable'};
44  
45 }
46  
47 0 $frame = XAS::Lib::Stomp::Frame->new(
48 -command => 'CONNECT',
49 -headers => $header,
50 -body => ''
51 );
52  
53 0 return $frame;
54  
55 }
56  
57 sub stomp {
58 0 ▶ my $self = shift;
Subroutine stomp: not called CC=6 SCAR=37.4
Pod documented
59 0 my $p = $self->validate_params(\@_, {
60 -login => { optional => 1, default => undef },
61 -passcode => { optional => 1, default => undef },
62 -prefetch => { optional => 1, default => undef },
63 -host => { optional => 1, default => 'localhost' },
64 -heart_beat => { optional => 1, default => '0,0', regex => qr/\d+,\d+/ },
65 -acceptable => {
66 optional => 1,
67 default => '1.0,1.1,1.2',
68 callbacks => {
69 'valid target' => \&_match
70 }
71 }
72 });
73  
74 0 my $frame;
75 0 my $header = {};
76  
77 0 ▶ if ($self->env->mqlevel == 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel == 1) 0 0 0
78  
79 0 $self->throw_msg(
80 'xas.lib.stomp.utils.stomp.nosup',
81 'stomp_no_support',
82 $self->env->mqlevel,
83 'stomp'
84 );
85  
86 }
87  
88 0 ▶ $header->{'login'} = $p->{'login'} if (defined($p->{'login'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"login"} 0 0 0
89 0 ▶ $header->{'passcode'} = $p->{'passcode'} if (defined($p->{'passcode'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"passcode"} 0 0 0
90 0 ▶ $header->{'prefetch-size'} = $p->{'prefetch'} if (defined($p->{'prefetch'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"prefetch"} 0 0 0
91  
92 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
93  
94 0 $header->{'host'} = $p->{'host'};
95 0 $header->{'heart-beat'} = $p->{'heart_beat'};
96 0 $header->{'accept-version'} = $p->{'acceptable'};
97  
98 }
99  
100 0 $frame = XAS::Lib::Stomp::Frame->new(
101 -command => 'STOMP',
102 -headers => $header,
103 -body => ''
104 );
105  
106 0 return $frame;
107  
108 }
109  
110 sub subscribe {
111 0 ▶ my $self = shift;
Subroutine subscribe: not called CC=4 SCAR=30.0
Pod documented
112 0 my $p = $self->validate_params(\@_, {
113 -destination => 1,
114 -prefetch => { optional => 1, default => 0 },
115 -id => { optional => 1, default => undef },
116 -receipt => { optional => 1, default => undef },
117 -ack => { optional => 1, default => 'auto', regex => qr/auto|client|client\-individual/ },
118 });
119  
120 0 my $frame;
121 0 my $header = {};
122  
123 0 $header->{'ack'} = $p->{'ack'};
124 0 $header->{'prefetch-count'} = $p->{'prefetch'};
125 0 $header->{'destination'} = $p->{'destination'};
126 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
127  
128 0 ▶ if (defined($p->{'-id'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p->{'-id'}) { } 0 0 0
129  
130 0 $header->{'id'} = $p->{'id'};
131  
132 } else {
133  
134 # v1.1 and greater must have an id header
135  
136 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
137  
138 0 $self->throw_msg(
139 'xas.lib.stomp.utils.subscribe',
140 'stomp_no_id',
141 $self->env->mqlevel
142
143 );
144  
145 }
146  
147 }
148  
149 0 $frame = XAS::Lib::Stomp::Frame->new(
150 -command => 'SUBSCRIBE',
151 -headers => $header,
152 -body => ''
153 );
154  
155 0 return $frame;
156  
157 }
158  
159 sub unsubscribe {
160 0 ▶ my $self = shift;
Subroutine unsubscribe: not called CC=8 SCAR=42.8
Pod documented
161 0 my $p = $self->validate_params(\@_, {
162 -id => { optional => 1, default => undef },
163 -destination => { optional => 1, default => undef },
164 -receipt => { optional => 1, default => undef },
165 });
166  
167 0 my $frame;
168 0 my $header = {};
169  
170 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
171  
172 # v1.0 should have either a destination and/or id header
173 # v1.1 and greater may have a destination header
174  
175 0 ▶ if (defined($p->{'destination'}) && defined($p->{'id'})) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $p->{'destination'} and defined $p->{'id'}) { } 0 0 0
elsif (defined $p->{'destination'}) { } 0 0 0
elsif (defined $p->{'id'}) { } 0 0 0
Condition0%0/3
defined $p->{"destination"} and defined $p->{"id"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $p->{"destination"} and defined $p->{"id"}
defined $p->{"destination"} defined $p->{"id"}
Truth table0%0/3
A and B
A= defined $p->{"destination"}B= defined $p->{"id"}
ABresult
0X0
100
111
176  
177 0 $header->{'id'} = $p->{'id'};
178 0 $header->{'destination'} = $p->{'destination'};
179  
180 } elsif (defined($p->{'destination'})) {
181  
182 0 $header->{'destination'} = $p->{'destination'};
183  
184 } elsif (defined($p->{'id'})) {
185  
186 0 $header->{'id'} = $p->{'id'};
187  
188 } else {
189  
190 0 $self->throw_msg(
191 'xas.lib.stomp.utils.unsubscribe.invparams',
192 'stomp_invalid_params',
193 $self->env->mqlevel
194 );
195  
196 }
197  
198 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
199  
200 # v1.1 and greater must have an id header
201  
202 0 ▶ unless (defined($header->{'id'})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $header->{"id"}) 0 0 0
203  
204 0 $self->throw_msg(
205 'xas.lib.stomp.utils.unsubscribe.noid',
206 'stomp_no_id',
207 $self->env->mqlevel
208 );
209  
210 }
211  
212 }
213  
214 0 $frame = XAS::Lib::Stomp::Frame->new(
215 -command => 'UNSUBSCRIBE',
216 -headers => $header,
217 -body => ''
218 );
219  
220 0 return $frame;
221  
222 }
223  
224 sub begin {
225 0 ▶ my $self = shift;
Subroutine begin: not called CC=2 SCAR=17.9
Pod documented
226 0 my $p = $self->validate_params(\@_, {
227 -transaction => 1,
228 -receipt => { optional => 1, default => undef },
229 });
230  
231 0 my $frame;
232 0 my $header = {};
233  
234 0 $header->{'transaction'} = $p->{'transaction'};
235 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
236  
237 0 $frame = XAS::Lib::Stomp::Frame->new(
238 -command => 'BEGIN',
239 -headers => $header,
240 -body => ''
241 );
242  
243 0 return $frame;
244  
245 }
246  
247 sub commit {
248 0 ▶ my $self = shift;
Subroutine commit: not called CC=2 SCAR=17.9
Pod documented
249 0 my $p = $self->validate_params(\@_, {
250 -transaction => 1,
251 -receipt => { optional => 1, default => undef },
252 });
253  
254 0 my $frame;
255 0 my $header = {};
256  
257 0 $header->{'transaction'} = $p->{'transaction'};
258 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
259  
260 0 $frame = XAS::Lib::Stomp::Frame->new(
261 -command => 'COMMIT',
262 -headers => $header,
263 -body => ''
264 );
265  
266 0 return $frame;
267  
268 }
269  
270 sub abort {
271 0 ▶ my $self = shift;
Subroutine abort: not called CC=2 SCAR=17.9
Pod documented
272 0 my $p = $self->validate_params(\@_, {
273 -transaction => 1,
274 -receipt => { optional => 1, default => undef },
275 });
276  
277 0 my $frame;
278 0 my $header = {};
279  
280 0 $header->{'transaction'} = $p->{'transaction'};
281 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
282  
283 0 $frame = XAS::Lib::Stomp::Frame->new(
284 -command => 'ABORT',
285 -headers => $header,
286 -body => ''
287 );
288  
289 0 return $frame;
290  
291 }
292  
293 sub ack {
294 0 ▶ my $self = shift;
Subroutine ack: not called CC=6 SCAR=37.4
Pod documented
295 0 my $p = $self->validate_params(\@_, {
296 -message_id => 1,
297 -subscription => { optional => 1, default => undef },
298 -receipt => { optional => 1, default => undef },
299 -transaction => { optional => 1, default => undef },
300 });
301  
302 0 my $frame;
303 0 my $header = {};
304  
305 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
306 0 ▶ $header->{'transaction'} = $p->{'transaction'} if (defined($p->{'transaction'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"transaction"} 0 0 0
307  
308 0 ▶ if ($self->env->mqlevel < 1.2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel < 1.2) { } 0 0 0
309  
310 0 $header->{'message-id'} = $p->{'message_id'};
311  
312 } else {
313  
314 0 $header->{'id'} = $p->{'message_id'};
315  
316 }
317  
318 0 ▶ if (defined($p->{'subscription'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p->{'subscription'}) { } 0 0 0
319  
320 0 $header->{'subscription'} = $p->{'subscription'};
321  
322 } else {
323  
324 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
325  
326 0 $self->throw_msg(
327 'xas.lib.stomp.utils.ack.nosup',
328 'stomp_no_subscription',
329 $self->env->mqlevel
330 );
331  
332 }
333  
334 }
335  
336 0 $frame = XAS::Lib::Stomp::Frame->new(
337 -command => 'ACK',
338 -headers => $header,
339 -body => ''
340 );
341  
342 0 return $frame;
343  
344 }
345  
346 sub nack {
347 0 ▶ my $self = shift;
Subroutine nack: not called CC=7 SCAR=40.3
Pod documented
348 0 my $p = $self->validate_params(\@_, {
349 -message_id => 1,
350 -receipt => { optional => 1, default => undef },
351 -subscription => { optional => 1, default => undef },
352 -transaction => { optional => 1, default => undef },
353 });
354  
355 0 my $frame;
356 0 my $header = {};
357  
358 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
359 0 ▶ $header->{'transaction'} = $p->{'transaction'} if (defined($p->{'transaction'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"transaction"} 0 0 0
360  
361 0 ▶ if ($self->env->mqlevel == 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel == 1) 0 0 0
362  
363 0 $self->throw_msg(
364 'xas.lib.stomp.utils.nack',
365 'stomp_no_support',
366 $self->env->mqlevel,
367 'nack'
368 );
369  
370 }
371  
372 0 ▶ if ($self->env->mqlevel < 1.2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel < 1.2) { } 0 0 0
373  
374 0 $header->{'message-id'} = $p->{'message_id'};
375  
376 } else {
377  
378 0 $header->{'id'} = $p->{'message_id'};
379  
380 }
381  
382 0 ▶ if (defined($p->{'subscription'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p->{'subscription'}) { } 0 0 0
383  
384 0 $header->{'subscription'} = $p->{'subscription'};
385  
386 } else {
387  
388 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
389  
390 0 $self->throw_msg(
391 'xas.lib.stomp.utils.nact',
392 'stomp_no_support',
393 $self->env->mqlevel,
394 'nack'
395 );
396  
397 }
398  
399 }
400  
401 0 $frame = XAS::Lib::Stomp::Frame->new(
402 -command => 'NACK',
403 -headers => $header,
404 -body => ''
405 );
406  
407 0 return $frame;
408  
409 }
410  
411 sub disconnect {
412 0 ▶ my $self = shift;
Subroutine disconnect: not called CC=2 SCAR=17.9
Pod documented
413 0 my $p = $self->validate_params(\@_, {
414 -receipt => { optional => 1, default => undef }
415 });
416  
417 0 my $frame;
418 0 my $header = {};
419  
420 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
421  
422 0 $frame = XAS::Lib::Stomp::Frame->new(
423 -command => 'DISCONNECT',
424 -headers => $header,
425 -body => ''
426 );
427  
428 0 return $frame;
429  
430 }
431  
432 sub send {
433 0 ▶ my $self = shift;
Subroutine send: not called CC=6 SCAR=34.5
Pod documented
434 0 my $p = $self->validate_params(\@_, {
435 -destination => 1,
436 -message => 1,
437 -receipt => { optional => 1, default => undef },
438 -persistent => { optional => 1, default => undef },
439 -transaction => { optional => 1, default => undef },
440 -length => { optional => 1, default => undef },
441 -type => { optional => 1, default => 'text/plain' },
442 });
443  
444 0 my $frame;
445 0 my $header = {};
446 0 my $body = $p->{'message'};
447  
448 0 $header->{'destination'} = $p->{'destination'};
449 0 ▶ $header->{'receipt'} = $p->{'receipt'} if (defined($p->{'receipt'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"receipt"} 0 0 0
450 0 ▶ $header->{'persistent'} = $p->{'persistent'} if (defined($p->{'presistent'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"presistent"} 0 0 0
451 0 ▶ $header->{'transaction'} = $p->{'transaction'} if (defined($p->{'transaction'}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p->{"transaction"} 0 0 0
452 {
453 1 ▶ use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.2
454 0 ▶ $header->{'content-length'} = defined($p->{'length'}) ? $p->{'length'} : length($body);
Branch: 1 branch
BranchTrueFalseTotal
defined $p->{'length'} ? : 0 0 0
455 }
456  
457 0 ▶ if ($self->env->mqlevel > 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel > 1) 0 0 0
458  
459 0 $header->{'content-type'} = $p->{'type'};
460  
461 }
462  
463 0 $frame = XAS::Lib::Stomp::Frame->new(
464 -command => 'SEND',
465 -headers => $header,
466 -body => $body
467 );
468  
469 0 return $frame;
470  
471 }
472  
473 sub noop {
474 0 ▶ my $self = shift;
Subroutine noop: not called CC=2 SCAR=17.9
Pod documented
475  
476 0 my $frame;
477  
478 0 ▶ if ($self->env->mqlevel == 1.0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->env->mqlevel == 1) 0 0 0
479  
480 0 $self->throw_msg(
481 'xas.lib.stomp.utils.noop.nosup',
482 'stomp_no_support',
483 $self->env->mqlevel,
484 'noop'
485 );
486  
487 }
488  
489 0 $frame = XAS::Lib::Stomp::Frame->new(
490 -command => 'NOOP',
491 -headers => {},
492 -body => ''
493 );
494  
495 0 return $frame;
496  
497 }
498  
499 # -----------------------------------------------------------
500 # Private Methods
501 # -----------------------------------------------------------
502  
503 sub _match {
504 0 ▶ my $buffer = shift;
Subroutine _match: not called CC=3 SCAR=24.8
505  
506 0 foreach my $item (split(',', $buffer)) {
507  
508 0 ▶ return 0 if ($item !~ m/\d\.\d/);
Branch: 1 branch
BranchTrueFalseTotal
unless $item =~ /\d\.\d/ 0 0 0
509  
510 }
511  
512 0 return 1;
513  
514 }
515  
516 1 1;
517  
518 __END__
519  
520 =head1 NAME
521  
522 XAS::Lib::Stomp::Utils - STOMP protocol utilities for clients
523  
524 =head1 SYNOPSIS
525  
526 This module uses XAS::Lib::Stomp::Frame to create STOMP frames.
527  
528 use XAS::Lib::Stomp::Utils;
529  
530 my $stomp = XAS::Lib::Stomp::Utils->new();
531 my $frame = $stomp->connect(
532 -login => 'test',
533 -passcode => 'test'
534 );
535  
536 put($frame->to_string);
537  
538 =head1 DESCRIPTION
539  
540 This module is an easy way to create STOMP frames without worrying about
541 the various differences between the protocol versions.
542  
543 =head1 METHODS
544  
545 =head2 new
546  
547 This method initializes the base object. It takes the following parameters:
548  
549 =head2 connect
550  
551 This method creates a "CONNECT" frame. This frame is used to initiate a
552 session with a STOMP server. On STOMP v1.1 and later targets the following
553 headers are automatically set:
554  
555 host
556 heart-beat
557 accept-version
558  
559 Unless otherwise specified, they will be the defaults. This method takes the
560 following parameters:
561  
562 =over 4
563  
564 =item B<-login>
565  
566 An optional login name to be used on the STOMP server.
567  
568 =item B<-passcode>
569  
570 An optional password for the login name on the STOMP server.
571  
572 =item B<-host>
573  
574 An optional virtual host name to connect to on STOMP v1.1 and later servers.
575 Defaults to 'localhost'.
576  
577 =item B<-heart_beat>
578  
579 An optional heart beat request for STOMP v1.1 and later servers. The default
580 is to turn them off.
581  
582 =item B<-acceptable>
583  
584 An optional list of protocol versions that are acceptable to this client for
585 STOMP v1.1 and later clients. The default is '1.0,1.1,1.2'.
586  
587 =item B<-prefetch>
588  
589 This sets the optional header 'prefetch-size' for RabbitMQ or other servers
590 that support this extension.
591  
592 =back
593  
594 =head2 stomp
595  
596 This method creates a "STOMP" frame, this works the same as connect(), but
597 only works for STOMP v1.1 and later targets. Please see the documentation for
598 connect().
599  
600 =head2 disconnect
601  
602 This method creates a "DISCONNECT" frame. This frame is used to signal the
603 server that you no longer wish to communicate with it. This method takes the
604 following parameters:
605  
606 =over 4
607  
608 =item B<-receipt>
609  
610 An optional receipt that will be returned by the server.
611  
612 =back
613  
614 =head2 subscribe
615  
616 This method create a "SUBSCRIBE" frame. This frame is used to notify
617 the server which queues you want to listen too. The naming of queues is
618 left up to the server implementation. This method takes the following
619 parameters:
620  
621 =over 4
622  
623 =item B<-destination>
624  
625 The name of the queue you wish to subscribe too. Naming convention is
626 server dependent.
627  
628 =item B<-subscription>
629  
630 A mandatory subscription id for usage on STOMP v1.1 and later targets. It
631 has no meaning for STOMP v1.0 servers.
632  
633 =item B<-ack>
634  
635 The type of acknowledgement you would like to receive when messages are sent
636 to a queue. It defaults to 'auto'. It understands 'auto', 'client' and
637 'client-individual'. Please refer to the STOMP protocol reference for
638 what this means.
639  
640 =item B<-receipt>
641  
642 An optional receipt that will be returned by the server.
643  
644 =back
645  
646 =head2 unsubscribe
647  
648 This method creates an "UNSUBSCRIBE" frame. This frame is used to notify the
649 server that you don't want to subscribe to a queue anymore. Subsequently
650 any messages left on that queue will no longer be sent to your client.
651  
652 =over 4
653  
654 =item B<-destination>
655  
656 The optional name of the queue that you subscribed too. STOMP v1.0 targets
657 need a queue name and/or a subscription id to unsubscribe. This is optional
658 on v1.1 and later targets.
659  
660 =item B<-subscription>
661  
662 The id of the subscription, this should be the same as the one used
663 with subscribe(). This is optional on STOMP v1.0 servers and mandatory
664 on v1.1 and later targets.
665  
666 =item B<-receipt>
667  
668 An optional receipt that will be returned by the server.
669  
670 =back
671  
672 =head2 begin
673  
674 This method creates a "BEGIN" frame. This frame signals the server that a
675 transaction is beginning. A transaction is either ended by a "COMMIT" frame
676 or an "ABORT" frame. Any other frame that is sent must have a transaction id
677 associated with them. This method takes the following parameters:
678  
679 =over 4
680  
681 =item B<-transaction>
682  
683 The mandatory id for the transaction.
684  
685 =item B<-receipt>
686  
687 An optional receipt that will be returned by the server.
688  
689 =back
690  
691 =head2 commit
692  
693 This method creates a "COMMIT" frame. This frame signals the end of a
694 transaction. This method takes the following parameters:
695  
696 =over 4
697  
698 =item B<-transaction>
699  
700 The mandatory transaction id from begin().
701  
702 =item B<-receipt>
703  
704 An optional receipt that will be returned by the server.
705  
706 =back
707  
708 =head2 abort
709  
710 This method creates an "ABORT" frame. This frame is used to signal the server
711 that the current transaction is to be aborted.
712  
713 This method takes the following parameters:
714  
715 =over 4
716  
717 =item B<-transaction>
718  
719 The mandatory transaction id from begin().
720  
721 =item B<-receipt>
722  
723 An optional receipt that will be returned by the server.
724  
725 =back
726  
727 =head2 send
728  
729 This method creates a "SEND" frame. This frame is the basis of communication
730 over your queues to the server. This method takes the following parameters:
731  
732 =over 4
733  
734 =item B<-destination>
735  
736 The name of the queue to send the message too.
737  
738 =item B<-message>
739  
740 The message to be sent. No attempt is made to serializes the message.
741  
742 =item B<-transaction>
743  
744 An optional transaction number. This should be the same as for begin().
745  
746 =item B<-length>
747  
748 An optional length for the message. If one is not specified a
749 'content-length' header will be auto generated.
750  
751 =item B<-type>
752  
753 An optional MIME type for the message. If one is not specified, 'text/plain'
754 will be used. This only has meaning for STOMP v1.1 and later targets.
755  
756 =item B<-persistent>
757  
758 An optional header for indicating that this frame should be 'persisted' by
759 the server. What this means, is highly server specific.
760  
761 =item B<-receipt>
762  
763 An optional receipt that will be returned by the server.
764  
765 =back
766  
767 =head2 ack
768  
769 This method creates an "ACK" frame. This frame is used to tell the server that
770 the message was successfully received. This method takes the following
771 parameters:
772  
773 =over 4
774  
775 =item B<-message_id>
776  
777 The id of the message that is being acked.
778  
779 =item B<-subscription>
780  
781 This should match the id from the subscribe() method. This has meaning for
782 STOMP v1.1 and later targets.
783  
784 =item B<-transaction>
785  
786 The transaction id if this ack is part of a transaction.
787  
788 =item B<-receipt>
789  
790 An optional receipt that will be returned by the server.
791  
792 =back
793  
794 =head2 nack
795  
796 This method creates a "NACK" frame. It notifies the server that the message
797 was rejected. It has meaning on STOMP v1.1 and later targets. This method
798 takes the following parameters:
799  
800 =over 4
801  
802 =item B<-message_id>
803  
804 The id of the message that is being nacked.
805  
806 =item B<-subscription>
807  
808 This should match the id from the subscribe() method. This has meaning for
809 STOMP v1.1 and later targets.
810  
811 =item B<-transaction>
812  
813 The transaction id if this nack is part of a transaction.
814  
815 =item B<-receipt>
816  
817 An optional receipt that will be returned by the server.
818  
819 =back
820  
821 =head2 noop
822  
823 This method creates a "NOOP" frame. It has meaning on STOMP v1.1 and
824 later targets.
825  
826 =head1 SEE ALSO
827  
828 =over 4
829  
830 =item L<Net::Stomp|https://metacpan.org/pod/Net::Stomp>
831  
832 =item L<Net::Stomp::Frame|https://metacpan.org/pod/Net::Stomp::Frame>
833  
834 =item L<XAS|XAS>
835  
836 =back
837  
838 For more information on the STOMP protocol, please refer to: L<http://stomp.github.io/> .
839  
840 =head1 AUTHOR
841  
842 Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
843  
844 =head1 COPYRIGHT AND LICENSE
845  
846 Copyright (C) 2014 Kevin L. Esteb
847  
848 This is free software; you can redistribute it and/or modify it under
849 the terms of the Artistic License 2.0. For details, see the full text
850 of the license at http://www.perlfoundation.org/artistic_license_2_0.
851  
852 =cut
« blib/lib/XAS/Lib/SSH/Client/Shell.pm ↑ Summary blib/lib/XAS/Lib/Process/Unix.pm »