-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.d.ts
5119 lines (5115 loc) · 206 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { EventEmitter } from "events";
import { Long } from "long";
declare namespace solace {
/**
* <b>This class is not exposed for construction by API users. Users should obtain an instances from
* one of the following:</b>
* * {@link solace.SolclientFactory.createTopicDestination}
* * {@link solace.SolclientFactory.createDurableQueueDestination}
* * {@link solace.MessageConsumer#getDestination}
* * {@link solace.SDTField#getValue} when {@link solace.SDTField#getType} returns
* {@link solace.SDTFieldType.DESTINATION}.
*
* Represents a message destination.
*
* Publishers can send messages to topics or queues, to which subscribers can subscribe or
* bind. A Destination specifies the target of such an operation.
*/
class Destination {
/** @protected */
protected constructor();
readonly name: string;
readonly type: solace.DestinationType;
/**
* @returns {string} The destination name specified at creation time.
*/
getName(): string;
/**
* @returns {solace.DestinationType} The destination type
*/
getType(): solace.DestinationType;
/**
* @returns {string} A generic description of the Destination.
*/
toString(): string;
}
/**
* <b>This class is not exposed for construction by API users.</b>
* An error thrown when calling an API that has not been implemented.
*/
class NotImplementedError extends solace.SolaceError {
/** @protected */
protected constructor();
/**
* Error Message.
*/
message: string;
/**
* The name of the error.
*/
name: string;
}
/**
* <b>This class is not exposed for construction by API users.</b>
* An error thrown by the API when an operational error is encountered.
*/
class OperationError extends solace.SolaceError {
/** @protected */
protected constructor();
/**
* 'OperationError'
*/
readonly name: string;
/**
* The subcode for the error. @see {@link solace.ErrorSubcode}
*/
subcode: solace.ErrorSubcode;
/**
* The reason for the error: an embedded error object or exception.
*/
reason: object;
/**
* Error Message.
*/
message: string;
}
/**
* <b>This class is not exposed for construction by API users.</b>
*
* Represents a request failure event; request failure events are passed to the application
* event handling callback provided when sending the request {@link solace.Session#sendRequest}
*/
class RequestError extends solace.OperationError {
/** @protected */
protected constructor();
/**
* 'RequestError'
*/
readonly name: string;
/**
* A code that provides more information about the error event.
*/
requestEventCode: solace.SessionEventCode;
/**
* The subcode for the error. @see {@link solace.ErrorSubcode}
*/
subcode: solace.ErrorSubcode;
/**
* The reason for the error: an embedded error object or exception.
*/
reason: object;
/**
* Error Message.
*/
message: string;
}
/**
* <b>This class is not exposed for construction by API users.</b>
* The base class for all errors thrown by the API.
*/
class SolaceError {
/** @protected */
protected constructor();
/**
* Error Message.
*/
message: string;
/**
* The name of the error.
*/
name: string;
}
/**
* Properties used during initialization of {@link solace.SolclientFactory}.
*/
class SolclientFactoryProperties {
/**
* Creates an instance of SolclientFactoryProperties.
* @param {object} options The property names and values to apply to this instance
* @param {solace.LogLevel} options.logLevel logLevel (default={@link solace.LogLevel.INFO}
* @param {solace.LogImpl} options.logger log implementation (default=NULL)
* @param {solace.SolclientFactoryProfiles} options.profile Javascript profile
(default={@link solace.SolclientFactoryProfiles.version7})
*/
constructor(options?: {
logLevel?: solace.LogLevel;
logger?: solace.LogImpl;
profile?: solace.SolclientFactoryProfiles;
});
/**
* The factory profile to use. The following factory profiles are available:
* * {@link solace.SolclientFactoryProfiles.version7}, a backwards-compatible profile
* for existing solClientJS 7.x applications
* * {@link solace.SolclientFactoryProfiles.version10}, the recommended profile
* for new applications
*/
profile: solace.SolclientFactoryProfiles;
/**
* The logging level to use for filtering log events. Messages with a level of lesser importance
* than this will be filtered out and not logged.
*/
logLevel: solace.LogLevel;
/**
* The logging implementation to use. In the debug API, the log implementation will be called
* for every log statement not filtered out by the log level. If no implementation is supplied,
* the default implementation will be used, which logs to the global console object.
*/
logger: solace.LogImpl;
}
/**
* A class that provides a binding to a log implementation. Applications that need to
* control API logging must construct a LogImpl
* instance, a log implementation that can be set in
* {@link solace.SolclientFactoryProperties#logger}.
* The binding will call the supplied log methods with the
* parameters supplied to each.
*/
class LogImpl {
/**
* @param {typeof solace.LogImpl.loggingCallback} trace Callback for {@link solace.LogLevel.TRACE} logs.
* @param {typeof solace.LogImpl.loggingCallback} debug Callback for {@link solace.LogLevel.DEBUG} logs.
* @param {typeof solace.LogImpl.loggingCallback} info Callback for {@link solace.LogLevel.INFO} logs.
* @param {typeof solace.LogImpl.loggingCallback} warn Callback for {@link solace.LogLevel.WARN} logs.
* @param {typeof solace.LogImpl.loggingCallback} error Callback for {@link solace.LogLevel.ERROR} logs.
* @param {typeof solace.LogImpl.loggingCallback} fatal Callback for {@link solace.LogLevel.FATAL} logs.
*/
constructor(
trace: typeof solace.LogImpl.loggingCallback,
debug: typeof solace.LogImpl.loggingCallback,
info: typeof solace.LogImpl.loggingCallback,
warn: typeof solace.LogImpl.loggingCallback,
error: typeof solace.LogImpl.loggingCallback,
fatal: typeof solace.LogImpl.loggingCallback
);
/**
* A logging callback. It must accept any valid number of arguments of any type. It must not throw.
* @param {any} args The arguments to log. Typically this is a mixture of strings and
objects to be inspected. A simple implementation might call .toString() on each
argument.
*/
static loggingCallback(args: any): void;
}
/**
* Message consumer event objects. A {@link solace.MessageConsumer} will emit
* these events related to queue subscription management:
* MessageConsumerEventName.SUBSCRIPTION_OK and
* MessageConsumerEventName.SUBSCRIPTION_ERROR.
*
* Similar to SessionEvent.
* Also compatible with RequestError.
*/
class MessageConsumerEvent {
/**
* @param {string} messageConsumerEventName one of the MessageConsumerEventNames.
* @param {string} infoStr Information string
* @param {number} responseCode Any associated router response code
* @param {solace.ErrorSubcode} errorSubcode Any associated error subcode
* @param {object} correlationKey Any associated correlation key
* @param {string} reason Any additional information
*/
constructor(
messageConsumerEventName: string,
infoStr: string,
responseCode?: number,
errorSubcode?: solace.ErrorSubcode,
correlationKey?: object,
reason?: string
);
/**
* the appropriate MessageConsumerEventName
*
* MessageConsumerEventName.SUBSCRIPTION_OK or
* MessageConsumerEventName.SUBSCRIPTION_ERROR.
*/
messageConsumerEventName: string;
/**
* the appropriate MessageConsumerEventName
*
* MessageConsumerEventName.SUBSCRIPTION_OK or
* MessageConsumerEventName.SUBSCRIPTION_ERROR.
*/
name: string;
/**
* if applicable, an information string returned by the Solace Message Router.
*/
infoStr: string;
/**
* if applicable, a response code returned by the Solace Message Router.
*/
responseCode: number;
/**
* if applicable, an error subcode. Defined in {@link solace.ErrorSubcode}
* same as subcode.
*/
errorSubcode: solace.ErrorSubcode;
/**
* if applicable, an error subcode. Defined in {@link solace.ErrorSubcode}
* Same as errorSubcode.
*/
subcode: solace.ErrorSubcode;
/**
* A user-specified object
* made available in the response or confirmation event by including it as a
* parameter in the orignal API call. If the user did not specify a
* correlationKey, it will be <code>null</code>.
*/
correlationKey: object;
/**
* Additional information if it is applicable.
*
* In case of subscribe or publish events, it constains the topic.
*/
reason: string;
/**
* Only here for compatibility with the RequestError exception class.
* Always returns undefined for a MessageConsumerEvent.
*/
requestEventCode: solace.SessionEventCode;
}
/**
* Defines the properties for a {@link solace.MessageConsumer}.
*/
class MessageConsumerProperties {
/**
*/
constructor();
/**
* Defines the queue from which to consume.
* * For durable queues and durable topic endpoints, this must be a
* {@link solace.QueueDescriptor} unless
* {@link solace.MessageConsumerProperties#createIfMissing} is set.
* * When an {@link solace.AbstractQueueDescriptor} is used, the name is generated when
* the {@link solace.MessageConsumer} is connected. The generated descriptor can be queried
* from the consumer after it has successfully connected by calling
* {@link solace.MessageConsumer#getProperties}.
*/
queueDescriptor: solace.QueueDescriptor;
/**
* Gets the properties of the remote queue.
* * For temporary queues and temporary topic endpoints,
* or if {@link solace.MessageConsumerProperties#createIfMissing} is true,
* these properties define the endpoint that is created.
* * For durable queues, these must be unset on consumer creation
* unless {@link solace.MessageConsumerProperties#createIfMissing} is set.
* The values will be populated
* after the queue is connected and can be retrieved by calling
* {@link solace.MessageConsumer#getProperties}.
*/
queueProperties: solace.QueueProperties;
/**
* The bind timeout in milliseconds when creating a connection to the Solace Message Router.
* * The valid range is >= 50.
*/
connectTimeoutInMsecs?: number;
/**
* Gets and sets the maximum number of bind attempts when creating a connection to the
* Solace Message Router.
* * The valid range is >= 1.
*/
connectAttempts?: number;
/**
* This must be undefined if the type of the
* {@link solace.MessageConsumerProperties#queueDescriptor} is not
* {@link solace.QueueType.TOPIC_ENDPOINT}.
*
* If {@link solace.MessageConsumerProperties#queueDescriptor} is
* not durable, or {@link solace.MessageConsumerProperties#createIfMissing} is true,
* this may be left undefined to generate the topic endpoint's
* destination. When generated, the destination can be obtained from
* the {@link solace.MessageConsumer} after it is connected by calling
* {@link solace.MessageConsumer#getDestination}.
*/
topicEndpointSubscription?: solace.Destination;
/**
* The Application Acknowledgement mode for the Message Consumer.
*
* When the acknowledgement mode is {@link solace.MessageConsumerAcknowledgeMode.CLIENT},
* a message is Application Acknowledged when the application calls
* {@link solace.Message#acknowledge} on that message.
*
* When the acknowledge mode is {@link solace.MessageConsumerAcknowledgeMode.AUTO}, a message is
* Application Acknowledged by the API after all
* {@link solace.MessageConsumerEventName#event:MESSAGE}
* listeners are called and none throw an exception. If a message handler throws, the message
* can still be acknowledged by calling {@link solace.Message#acknowledge}, but this would not be
* a recommended practice.
*
* When received messages are Application Acknowledged they are removed from the Guaranteed
* Message storage on the Solace Message Router. Message Consumer Application Acknowledged,
* <b>only</b> remove messages from the Solace Message Router.
*
* In particular, withholding Message Consumer Acknowledgemnts does not stop
* message delivery. For Message Consumer flow control (aka transport acknowledgemeent) see
* {@link solace.MessageConsumer#stop}/{@link solace.MessageConsumer#start}. Message Consumer
* flow control may also be imlpemented by removing the
* {@link solace.MessageConsumerEventName#event:MESSAGE} listener.
*
* Flow control and transport acknowledgements characteristics are defined by
* {@link solace.MessageConsumerProperties#transportAcknowledgeThresholdPercentage} and
* {@link solace.MessageConsumerProperties#transportAcknowledgeTimeoutInMsecs}
*/
acknowledgeMode?: solace.MessageConsumerAcknowledgeMode;
/**
* The transport acknowledgement timeout for guaranteed messaging.
* When the {@link solace.MessageConsumerProperties.transportAcknowledgeTimeoutInMsecs}
* is not exceeded, acknowledgements will be returned to the router at intervals not less than
* this value.
* * The valid range is 20 <= transportAcknowledgeTimeoutInMsecs <= 1500.
*/
transportAcknowledgeTimeoutInMsecs?: number;
/**
* The threshold for sending an acknowledgement, as a percentage.
* The API sends a transport acknowledgment every
* N messages where N is calculated as this percentage of the transport
* window size if the endpoint's max-delivered-unacked-msgs-per-flow
* setting at bind time is greater than or equal to the transport
* window size. Otherwise, N is calculated as this percentage of the
* endpoint's max-delivered-unacked-msgs-per-flow setting at bind time.
* * The valid range is 1 <= transportAcknowledgeThresholdPercentage <= 75.
*/
transportAcknowledgeThresholdPercentage?: number;
/**
* When enabled, a Guaranteed Messaging Consumer requests Active and Inactive
* events from the router and emits them to interested listeners.
*/
activeIndicationEnabled?: boolean;
/**
* When enabled, a Guaranteed Messaging Consumer does not receive messages published
* in the same Session, even if the endpoint contains a subscription that matches the published
* message.
*/
noLocal?: boolean;
/**
* The window size for Guaranteed Message delivery. This is the maximum number of messages that
* will be prefetched from the Solace Messaging Router and queued internally by the API while
* waiting for the application to accept delivery of the messages.
* * The valid range is 1 <= windowSize <= 255.
*/
windowSize?: number;
/**
* When a Flow is created, the application may request replay of messages from the replay log,
* even messages that have been previously delivered and removed the from topic endpoint or queue.
* The default is undefined, and indicates that no replay is requested.
*
* When defined the replay start location must be a {@link solace.ReplayStartLocation} object
* as returned by
* {@link solace.SolClientFactory.createReplayStartLocationBeginning} or
* {@link solace.SolClientFactory.createReplayStartLocationDate}.
*
* The {@link solace.ReplayStartLocation} returned by
* {@link solace.SolClientFactory.createReplayStartLocationBeginning}
* indicate that all messages available should be replayed.
*
* The replay start location returned by
* {@link solace.SolClientFactory.createReplayStartLocationDate}
* indicates that all messages logged since a given date must be retrieved.
*/
replayStartLocation?: solace.ReplayStartLocation;
/**
* When a connected flow receives an unsolicited unbind event with subcode
* REPLAY_STARTED or GM_UNAVAILABLE, the SDK can reconnect the flow automatically.
* This property controls the flow auto reconnect feature:
* 0: Disable flow auto reconnect for this consumer flow.
* -1: Enable flow auto reconnect for this consumer flow, infiinite retries (default)
* <n, positive number>: Enable flow auto reconnect for this consumer flow, n retries.
*
* When the flow auto rebind is enabled, DOWN_ERRORs with REPLAY_STARTED and GM_UNAVAILABLE
* are handled internally, and not (immediately) emitted to the application.
* A RECONNECTING event (with the same subcode) is emitted instead,
* ideally followed by a RECONNECTED event when the reconnect succeedes.
* In case of REPLAY_STARTED, the window of message IDs and acknowledgements are reset
* to allow replay packets to be passed to the application without marking them as duplicates.
* In case of GM_UNAVAILABLE, flow state is preserved.
*
* If reconnecting fails after exhausting the number of retries, a DOWN_ERROR is emitted
* with the details of the last retry.
*/
reconnectAttempts?: number;
/**
* Time to wait between flow auto reconnect attempts, in milliseconds.
* See {@link solace.MessageConsumerProperties.reconnectAttempts}
* Defaults to 3 seconds (3000)
* * The valid range is >= 50.
*/
reconnectIntervalInMsecs?: number;
/**
* If the endpoint is durable, it won't be auto-created unless this flag is set.
* This flag has no effect for temporary endpoints, those are always created if missing.
* This flag has no effect for existing endpoints.
*
* Off by default for backwards compatibility.
*/
createIfMissing?: boolean;
}
interface MessageConsumer {
on<U extends keyof solace.MessageConsumerEventNameEvents>(
event: U,
listener: solace.MessageConsumerEventNameEvents[U]
): this;
}
/**
* <b>This class is not exposed for construction by API users.</b>
* A Message Consumer is created by calling {@link solace.Session#createMessageConsumer}.
*
* A MessageConsumer controls Guaranteed Message delivery to this client.
*
* Consumer characteristics and behavior are defined by {@link solace.MessageConsumerProperties}.
* The properties can also be supplied as a simple key-value {Object}. The queue descriptor,
* {@link solace.MessageConsumerProperties#queueDescriptor} must be specified to identify the
* Guaranteed Message Queue or Guaranteed Message Topic Endpoint on the Solace Message Router.
*
* The MessageConsumer object is an EventEmitter, and will emit events to which the
* application may choose to subscribe, such as the connection to the Solace Message Router
* going up or down.
*
* If a registered listener for an emitted event throws an exception, this is caught and emitted as
* an 'error'.
* @fires solace.MessageConsumerEventName#event:ACTIVE
* @fires solace.MessageConsumerEventName#event:CONNECT_FAILED_ERROR
* @fires solace.MessageConsumerEventName#event:DISPOSED
* @fires solace.MessageConsumerEventName#event:DOWN
* @fires solace.MessageConsumerEventName#event:DOWN_ERROR
* @fires solace.MessageConsumerEventName#event:GM_DISABLED
* @fires solace.MessageConsumerEventName#event:INACTIVE
* @fires solace.MessageConsumerEventName#event:MESSAGE
* @fires solace.MessageConsumerEventName#event:UP
* @fires solace.MessageConsumerEventName#event:SUBSCRIPTION_OK
* @fires solace.MessageConsumerEventName#event:SUBSCRIPTION_ERROR
*/
class MessageConsumer extends EventEmitter {
/** @protected */
protected constructor();
/**
* After the MessageConsumer has connected to an endpoint
* ({@link solace.MessageConsumerEventName#UP}), accesstype represents
* the access type for the endpoint to which this Message Consumer is bound.
*/
static accessType: solace.QueueAccessType;
/**
* After the MessageConsumer has connected as indicated by the event
* {@link solace.MessageConsumerEventName#event:UP}, queueDiscardBehavior represents
* the discard behavior flags for the endpoint to which this Message Consumer is bound.
*/
static queueDiscardBehaviour: solace.QueueDiscardBehavior;
/**
* After the MessageConsumer has connected as indicated by the event
* {@link solace.MessageConsumerEventName#event:UP}
* respectsTTL is `true` when the endpoint respects Time To Live on messages
* and 'false' otherwise.
*/
static respectsTTL: boolean;
/**
* After the MessageConsumer has connected as indicated by the event
* {@link solace.MessageConsumerEventName#event:UP}, this property represents
* permissions granted by the router to this user on this Message Consumer
*/
static permissions: solace.QueuePermissions;
/**
* Returns true if this Guaranteed Message Consumer was disposed.
*/
disposed: void;
readonly session: void;
/**
* Begins delivery of messages to this consumer. This method opens the protocol window
* to the Solace Message Router so further messages can be received.
*
* A newly created consumer is in started state.
*
* If the consumer was already started, this method has no effect.
*
* A consumer is stopped by calling {@link solace.MessageConsumer.stop}
* @throws {solace.OperationError} * if the Message Consumer is disposed.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
* if the Message Consumer is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
start(): void;
/**
* Stops messages from being delivered to this consumer from the Solace Message Router.
* Messages may continue to be prefetched by the API and queued internally
* until {@link solace.MessageConsumer#start} is called.
*
* If the consumer was already stopped, this method has no effect.
* @throws {solace.OperationError} * if the Message Consumer is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
stop(): void;
/**
* Connects the consumer immediately. The application should add event listeners (see
* {@link solace.MessageConsumerEventName}). If there is no listener added for
* {@link solace.MessageConsumerEventName#event:MESSAGE} then up to a window
* {@link solace.MessageConsumerProperties.windowSize} of messages can be queued internally.
* to the {@link solace.MessageConsumer} before calling this method.
* @throws {solace.OperationError} * if consumer is not supported by router for this client.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
connect(): void;
/**
* Initiates an orderly disconnection of the Message Consumer. The API will send any pending
* client acknowledgements on the Message Consumer, then send an unbind request.
* Any messages subsequently
* received are discarded silently. When the unbind message is acknowledged, the application
* receives a {@link solace.MessageConsumerEventName#event:DOWN} event if it has set a listener
* for that event.
* @throws {solace.OperationError} * if the Message Consumer is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
disconnect(): void;
/**
* Returns the destination that should be used to publish messages that this consumer
* will receive.
* * For topic endpoints, this is the topic to which the topic endpoint is subscribed.
* * For queues, this is the associated queue destination.
*
* The destination returned can
* be used to set the ReplyTo field in a message, or otherwise communicated
* to partners that need to send messages to this Message Consumer. This is especially useful
* for temporary endpoints (Queues and Topic Endpoints), as the destination
* is unknown before the endpoint is created.
*
* This method will succeed after {@link solace.MessageConsumerEventName#event:UP} for temporaries
* with generated destinations.
* @returns {solace.Destination} The publishing destination that delivers to this consumer.
* @throws {solace.OperationError} * if the {@link solace.MessageConsumer} is disconnected and the destination is temporary.
*/
getDestination(): solace.Destination;
/**
* Creates and returns copy of the properties for this MessageConsumer.
*
* If the object was constructed using an {@link solace.AbstractQueueDescriptor},
* and the queue descriptor was subsequently connected to an endpoint, the
* `MessageConsumerProperties` returned will include a {@link solace.QueueDescriptor}
* that contains the resolved name.
*
* A new copy of the properties object is returned each time this property is accessed.
* The returned object cannot be polled for mutations such as the one described above.
* @returns {solace.MessageConsumerProperties} The properties associated with this object.
*/
getProperties(): solace.MessageConsumerProperties;
/**
* Subscribe the queue to a topic, always requesting confirmation from the router.
*
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_OK} is generated when subscription is
* added successfully; otherwise, session event
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_ERROR} is generated.
*
* When the application receives the event
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_ERROR}, it
* can obtain the failed topic subscription by calling
* {@link solace.MessageConsumerEvent#reason}.
* The returned string is in the format of "Topic: <failed topic subscription>".
* @param {solace.Destination} topic The topic destination subscription to add.
* @param {object} correlationKey If specified, this value is
echoed in the messageConsumer event within
{@link MessageConsumerEvent}.
* @param {number} requestTimeout The request timeout period (in milliseconds). If specified, this
value overwrites readTimeoutInMsecs property in
{@link SessionProperties}.
* @throws {solace.OperationError} * if the session is disposed or disconnected,
or the consumer is inactive, down, disconnected, or disposed.
Or if the consumer is bound to a topic endpoint instead of a queue.
Subcode: {@link solace.ErrorSubcode.INVALID_OPERATION}.
* if the parameters have an invalid type.
Subcode: {@link solace.ErrorSubcode.PARAMETER_INVALID_TYPE}.
* if the parameters have an invalid value.
Subcode: {@link solace.ErrorSubcode.PARAMETER_OUT_OF_RANGE}.
* if the topic has invalid syntax.
Subcode: {@link solace.ErrorSubcode.INVALID_TOPIC_SYNTAX}.
* if there's no space in the transport to send the request.
Subcode: {@link solace.ErrorSubcode.INSUFFICIENT_SPACE}. See:
{@link solace.SessionEventCode#event:CAN_ACCEPT_DATA}.
* if the topic is a shared subscription and the peer router does not support Shared
Subscriptions.
Subcode: {@link solace.ErrorSubcode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED}.
* if the topic is a shared subscription and the client does not allowed Shared
Subscriptions.
Subcode: {@link solace.ErrorSubcode.SHARED_SUBSCRIPTIONS_NOT_ALLOWED}.
*/
addSubscription(
topic: solace.Destination,
correlationKey: object,
requestTimeout: number
): void;
/**
* Unsubscribe the queue from a topic, requesting confirmation from the router.
*
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_OK} is generated when subscription is
* removed successfully; otherwise, session event
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_ERROR} is generated.
*
* When the application receives the message consumer event
* {@link solace.MessageConsumerEventName.SUBSCRIPTION_ERROR}, it
* can obtain the failed topic subscription by calling
* {@link solace.MessageConsumerEvent#reason}. The returned
* string is in the format "Topic: <failed topic subscription>".
* @param {solace.Destination} topic The topic destination subscription to remove.
* @param {object} correlationKey If <code>null</code> or undefined, a Correlation Key is not set
in the confirmation session event.
* @param {number} requestTimeout The request timeout period (in milliseconds). If specified, this
value overwrites readTimeoutInMsecs property in
{@link SessionProperties}.
* @throws {solace.OperationError} * if the session is disposed or disconnected,
or the consumer is inactive, down, disconnected, or disposed.
Or if the consumer is bound to a topic endpoint instead of a queue.
Subcode: {@link solace.ErrorSubcode.INVALID_OPERATION}.
* if the parameters have an invalid type.
Subcode: {@link solace.ErrorSubcode.PARAMETER_INVALID_TYPE}.
* if the parameters have an invalid value.
Subcode: {@link solace.ErrorSubcode.PARAMETER_OUT_OF_RANGE}.
* if the topic has invalid syntax.
Subcode: {@link solace.ErrorSubcode.INVALID_TOPIC_SYNTAX}.
* if there's no space in the transport to send the request.
Subcode: {@link solace.ErrorSubcode.INSUFFICIENT_SPACE}. See:
{@link solace.SessionEventCode#event:CAN_ACCEPT_DATA}.
* if the topic is a shared subscription and the peer router does not support Shared
Subscriptions.
Subcode: {@link solace.ErrorSubcode.SHARED_SUBSCRIPTIONS_NOT_SUPPORTED}.
* if the topic is a shared subscription and the client does not allowed Shared
Subscriptions.
Subcode: {@link solace.ErrorSubcode.SHARED_SUBSCRIPTIONS_NOT_ALLOWED}.
*/
removeSubscription(
topic: solace.Destination,
correlationKey: object,
requestTimeout: number
): void;
/**
* Clears all statistics for this Guaranteed Message Connection. All previous Guaranteed
* Message Connection statistics are lost
* when this is called.
* @throws {solace.OperationError} * if the Message Consumer is disposed. subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
clearStats(): void;
/**
* Disposes the Guaranteed Message connection, removing all listeners and releasing references.
*/
dispose(): void;
/**
* Returns a statistic for this Guaranteed Message connection.
* @param {solace.StatType} statType The statistic to return.
* @returns {number} The value for the statistic.
*/
getStat(statType: solace.StatType): number;
/**
* @returns {string} A description of this Guaranteed Message Connection
*/
toString(): string;
}
/**
* Defines the properties for a {@link solace.QueueBrowser}.
*/
class QueueBrowserProperties {
/**
*/
constructor();
/**
* Defines the queue from which to consume.
* * For durable queues and durable topic endpoints, this must be a
* {@link solace.QueueDescriptor}.
*/
queueDescriptor: solace.QueueDescriptor;
/**
* The bind timeout in milliseconds when creating a connection to the Solace Message Router.
* * The valid range is >= 50.
*/
connectTimeoutInMsecs?: number;
/**
* Gets and sets the maximum number of bind attempts when creating a connection to the
* Solace Message Router.
* * The valid range is >= 1.
*/
connectAttempts?: number;
/**
* The window size for Guaranteed Message delivery. This is the maximum number of messages that
* will be prefetched from the Solace Messaging Router and queued internally by the API while
* waiting for the application to accept delivery of the messages.
* * The valid range is 1 <= windowSize <= 255.
*/
windowSize?: number;
/**
* The transport acknowledgement timeout for guaranteed messaging in milliseconds.
* When the {@link solace.QueueBrowserProperties.transportAcknowledgeTimeoutInMsecs} is not
* exceeded, acknowledgements will be returned to the router at intervals not less than
* this value.
* * The valid range is 20 <= transportAcknowledgeTimeoutInMsecs <= 1500.
*/
transportAcknowledgeTimeoutInMsecs?: number;
/**
* The threshold for sending an acknowledgement, as a percentage.
* The API sends a transport acknowledgment every
* N messages where N is calculated as this percentage of the transport
* window size if the endpoint's max-delivered-unacked-msgs-per-flow
* setting at bind time is greater than or equal to the transport
* window size. Otherwise, N is calculated as this percentage of the
* endpoint's max-delivered-unacked-msgs-per-flow setting at bind time.
* * The valid range is 1 <= transportAcknowledgeThresholdPercentage <= 75.
*/
transportAcknowledgeThresholdPercentage?: number;
}
interface QueueBrowser {
on<U extends keyof solace.QueueBrowserEventNameEvents>(
event: U,
listener: solace.QueueBrowserEventNameEvents[U]
): this;
}
/**
* <b>This class is not exposed for construction by API users.</b>
* A Queue Browser is created by calling {@link solace.Session#createQueueBrowser}.
*
* A Queue Browser allows client applications to look at messages spooled on Endpoints
* without removing them. Messages are browsed from oldest to newest.
* After being browsed, messages are still available for consumption over normal flows.
* However, it is possible to selectively remove messages from the persistent store of an Endpoint.
* In this case, these removed messages will no longer be available for consumption.
* Note: If browsing a queue with an active consumer, no guarantee is made that the browser will
* receive all messages published to the queue. The consumer can receive and acknowledge messages
* before they are delivered to the browser.
*
* One typical application is to use Browsers to allow message bus administrators to remove “stuck”
* Guaranteed messages from an Endpoint without having to modify or disrupt existing applications.
* A message can get stuck if:
*
* 1) It has been received by an application, but for some reason, that application has failed to
* acknowledge it.
* 2) All active message selectors have failed to match this particular message and therefore the
* message bus has not delivered it to any client yet. The current release only supports
* browsing Endpoints of type Queue.
*
* Note that the delivery restrictions imposed by the queue’s Access type
* (exclusive or non-exclusive), do not apply when browsing messages with a Browser.
*
* Browser characteristics and behavior are defined by {@link solace.QueueBrowserProperties}.
* The properties can also be supplied as a simple key-value {Object}. The queue descriptor,
* {@link solace.QueueBrowserProperties#queueDescriptor} must be specified to identify the
* Guaranteed Message Queue on the Solace Message Router.
*
* The Browser is an EventEmitter, and will emit events to which the application may choose to
* subscribe, such as the connection to the Solace Message Router going up or down.
*
* If a registered listener for an emitted event throws an exception, this is caught and emitted as
* an 'error'.
* @fires solace.QueueBrowserEventName#event:CONNECT_FAILED_ERROR
* @fires solace.QueueBrowserEventName#event:DISPOSED
* @fires solace.QueueBrowserEventName#event:DOWN
* @fires solace.QueueBrowserEventName#event:DOWN_ERROR
* @fires solace.QueueBrowserEventName#event:GM_DISABLED
* @fires solace.QueueBrowserEventName#event:MESSAGE
* @fires solace.QueueBrowserEventName#event:UP
*/
class QueueBrowser extends EventEmitter {
/** @protected */
protected constructor();
/**
* Connects the queue browser immediately. The application should add event listeners (see
* {@link solace.QueueBrowserEventName}). If there is no listener added for
* {@link solace.QueueBrowserEventName#event:MESSAGE} then up to a window
* {@link solace.QueueBrowserProperties.windowSize} of messages can be queued internally.
* before calling this method.
* @throws {solace.OperationError} * if consumer is not supported by router for this client.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
connect(): void;
/**
* Initiates an orderly disconnection of the queue browser. The API will send an unbind request.
* Any messages subsequently received are discarded silently.
* When the unbind message is acknowledged, the application
* receives a {@link solace.QueueBrowserEventName#event:DOWN} event if it has set a listener
* for that event.
* @throws {solace.OperationError} * if the Message Consumer is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
disconnect(): void;
/**
* Begins delivery of messages to this queue browser. This method opens the protocol window
* to the Solace Message Router so further messages can be received.
*
* A newly created queue browser is in started state.
*
* If the queue browser was already started, this method has no effect.
*
* A consumer is stopped by calling {@link solace.QueueBrowser.stop}
* @throws {solace.OperationError} * if the Queue BrowserMessage Consumer is disposed.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
* if the Message Consumer is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
start(): void;
/**
* Stops messages from being delivered to this queue browser from the Solace Message Router.
* Messages may continue to be prefetched by the API and queued internally
* until {@link solace.QueueBrowser#start} is called.
*
* If the queue browser was already stopped, this method has no effect.
* @throws {solace.OperationError} * if the Queue Browser is disconnected.
subcode = {@link solace.ErrorSubcode.INVALID_OPERATION}
*/
stop(): void;
/**
* Removes a message from the queue by acknowledging it.
*
* The {@link solace.QueueBrowser} does not automatically acknowledge messages.
* once they have been received.
*
* The API does not send acknowledgments immediately. It stores the state for
* acknowledged messages internally and acknowledges messages, in bulk, when a
* threshold or timer is reached.
* @param {Message} message The message to remove
*/
removeMessageFromQueue(message: Message): void;
}
/**
* Properties that define the configuration for a guaranteed message publisher.
*/
class MessagePublisherProperties {
/**
* @param {object} options Properties to apply to the newly constructed object.
*/
constructor(options: object);
/**
* When enabled, a Guaranteed Messaging Publisher
* is automatically created when a session is connected.
*
* The default value is the same as the value provided to
* {@link solace.SolclientFactory.init},
* in the profile, {@link solace.SolclientFactoryProperties#profile},
* in the field {@link solace.FactoryProfile#guaranteedMessagingEnabled}.
*/
enabled: boolean;
/**
* Maximum number of messages that can be published
* without acknowledgment.
* * The valid range is 1 <= value <= 255
*/
windowSize?: number;
/**
* The time to wait for an acknowledgement,
* in milliseconds, before retransmitting unacknowledged
* messages.
* * The valid range is 20 <= value <= 60000.
*/
acknowledgeTimeoutInMsecs?: number;
/**
* The message-router sends windowed acknowledgements
* which the API converts to per-message acknowledgement by default. If
* acknowledgeMode is Windowed, then the API will simply pass through
* the message-router acknowledgements.
*/
acknowledgeMode?: solace.MessagePublisherAcknowledgeMode;
}
/**
* <b>This class is not exposed for construction by API users. Users should obtain an instance from
* {@link solace.SolclientFactory.createMessage}</b>
* <p>
* A message is a container that can be used to store and send messages to and from the
* Solace Message Router.
*
* Applications manage the lifecycle of a message; a message is created by calling
* {@link solace.SolclientFactory.createMessage} and is freed by dereferencing it.
*
* API operations that cache or mutate messages always take a copy. A message may
* be created, mutated by the API user, and sent multiple times.
*
* The Message Object provides methods to manipulate the common Solace
* message header fields that are optionally sent in the binary metadata
* portion of the Solace message.
*
* Applications can also use the structured data API {@link solace.Message#setSdtContainer}
* to add containers (maps or streams) and their fields to the binary payload or
* to the User Property map contained within the binary metadata.
*
* This does not prevent applications from ignoring these
* methods and sending payload in the binary payload as an opaque binary field for
* end-to-end communications
*/
class Message {
/** @protected */
protected constructor();
/**
* Returns whether acknowledge() has been called on this message.
*/
readonly isAcknowledged: boolean;
/**
* Gets the payload type ({@link solace.MessageType}) of the message. A message has a
* structured payload if one was attached via {@link solace.Message#setSdtContainer} otherwise
* if the payload is attached via {@link Message@setBinaryAttachment} then it
* is unstructured ({@link solace.MessageType#BINARY})
* @returns {solace.MessageType} The structured payload type.
*/
getType(): solace.MessageType;
/**
* Sets the application-provided message ID.
* @param {string} value The new value for the application-provided message ID.
*/
setApplicationMessageId(value: string): void;
/**
* Gets the application-provided message ID.
* @returns {string} The application provided message ID.
*/
getApplicationMessageId(): string | null;
/**
* Sets the application message type. This value is used by applications
* only, and is passed through the API and Solace Message Router untouched.
* @param {string} value The application message type.
*/
setApplicationMessageType(value: string): void;
/**
* Gets the application message type. This value is used by applications
* only, and is passed through the API and Solace Message Router untouched.
* @returns {string} The application message type.
*/
getApplicationMessageType(): string | null;
/**
* Gets the binary attachment part of the message.
*
* Backward compatibility note: Using the version10 factory profile or older,
* the binary attachment is returned as a 'latin1' String:
* Each character has a code in the range * 0-255
* representing the value of a single received byte at that position.
* @returns {Uint8Array} A TypedArray view of the binary attachment.
*/
getBinaryAttachment(): Uint8Array | null;
/**
* Sets the binary attachment part of the message.
*
* The binary attachment is conceptually an array of bytes.
* When this method is used, the message payload type is {@link solace.MessageType#BINARY}
* See {@link solace.Message#getType}.
*
* Applications may set the binary attachment to NULL or undefined to
* remove the binary attachment and create a message with no payload.
*
* The following types are accepted:
* Buffer (the nodeJS native type or equivalent)
* ArrayBuffer,
* Any DataView or TypedArray,
* 'latin1' String for backwards compatibility:
* each character has a code in the range 0-255
* representing exactly one byte in the attachment.
* @param {Uint8Array} value Sets the binary attachment part of the message.
*/
setBinaryAttachment(value: Uint8Array): void;
/**
* Given a Message containing a cached message, return the cache Request Id that
* the application set in the call to {@link solace.CacheSession#sendCacheRequest}.
* @returns {number} The request ID of the cache request associated with this message.
*/
getCacheRequestId(): number | null;
/**
* Gets the correlation ID. The message Correlation Id
* is carried in the Solace message headers unmodified by the API and
* the Solace Message Router. This field may be used for peer-to-peer