@google-cloud/pubsub 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +3 -1
  3. package/build/protos/google/pubsub/v1/pubsub.proto +12 -0
  4. package/build/protos/protos.d.ts +14 -1
  5. package/build/protos/protos.js +69 -1
  6. package/build/protos/protos.json +19 -1
  7. package/build/src/ack-metadata.js +2 -3
  8. package/build/src/ack-metadata.js.map +1 -1
  9. package/build/src/iam.d.ts +11 -3
  10. package/build/src/iam.js +12 -2
  11. package/build/src/iam.js.map +1 -1
  12. package/build/src/index.d.ts +2 -0
  13. package/build/src/index.js +5 -1
  14. package/build/src/index.js.map +1 -1
  15. package/build/src/lease-manager.d.ts +2 -3
  16. package/build/src/lease-manager.js +19 -3
  17. package/build/src/lease-manager.js.map +1 -1
  18. package/build/src/message-queues.d.ts +8 -4
  19. package/build/src/message-queues.js +17 -8
  20. package/build/src/message-queues.js.map +1 -1
  21. package/build/src/message-stream.d.ts +0 -1
  22. package/build/src/publisher/flow-publisher.js +5 -0
  23. package/build/src/publisher/flow-publisher.js.map +1 -1
  24. package/build/src/publisher/index.d.ts +3 -3
  25. package/build/src/publisher/index.js +24 -46
  26. package/build/src/publisher/index.js.map +1 -1
  27. package/build/src/publisher/message-batch.d.ts +13 -1
  28. package/build/src/publisher/message-batch.js +11 -1
  29. package/build/src/publisher/message-batch.js.map +1 -1
  30. package/build/src/publisher/message-queues.d.ts +0 -2
  31. package/build/src/publisher/message-queues.js +32 -6
  32. package/build/src/publisher/message-queues.js.map +1 -1
  33. package/build/src/publisher/pubsub-message.d.ts +43 -1
  34. package/build/src/publisher/pubsub-message.js +30 -2
  35. package/build/src/publisher/pubsub-message.js.map +1 -1
  36. package/build/src/pubsub.d.ts +5 -1
  37. package/build/src/pubsub.js +4 -14
  38. package/build/src/pubsub.js.map +1 -1
  39. package/build/src/subscriber.d.ts +72 -8
  40. package/build/src/subscriber.js +179 -51
  41. package/build/src/subscriber.js.map +1 -1
  42. package/build/src/subscription.d.ts +3 -3
  43. package/build/src/subscription.js +7 -4
  44. package/build/src/subscription.js.map +1 -1
  45. package/build/src/telemetry-tracing.d.ts +257 -0
  46. package/build/src/telemetry-tracing.js +648 -0
  47. package/build/src/telemetry-tracing.js.map +1 -0
  48. package/build/src/topic.d.ts +2 -2
  49. package/build/src/topic.js +8 -4
  50. package/build/src/topic.js.map +1 -1
  51. package/build/src/util.js +4 -4
  52. package/build/src/util.js.map +1 -1
  53. package/build/src/v1/publisher_client.d.ts +0 -1
  54. package/build/src/v1/schema_service_client.d.ts +0 -1
  55. package/build/src/v1/subscriber_client.d.ts +0 -1
  56. package/package.json +5 -4
  57. package/build/src/opentelemetry-tracing.d.ts +0 -23
  58. package/build/src/opentelemetry-tracing.js +0 -42
  59. package/build/src/opentelemetry-tracing.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,26 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/@google-cloud/pubsub?activeTab=versions
6
6
 
7
+ ## [4.7.0](https://github.com/googleapis/nodejs-pubsub/compare/v4.6.0...v4.7.0) (2024-08-24)
8
+
9
+
10
+ ### Features
11
+
12
+ * Add support for OTel context propagation and harmonized spans ([#1833](https://github.com/googleapis/nodejs-pubsub/issues/1833)) ([4b5c90d](https://github.com/googleapis/nodejs-pubsub/commit/4b5c90dc334e90cefb4da3c6fe9ce027b50aacb8))
13
+
14
+ ## [4.6.0](https://github.com/googleapis/nodejs-pubsub/compare/v4.5.0...v4.6.0) (2024-07-12)
15
+
16
+
17
+ ### Features
18
+
19
+ * Add max messages batching for Cloud Storage subscriptions ([#1956](https://github.com/googleapis/nodejs-pubsub/issues/1956)) ([90546f6](https://github.com/googleapis/nodejs-pubsub/commit/90546f634cc4e510185e20a4d1ba1c74ebc59b85))
20
+ * Add use_topic_schema for Cloud Storage Subscriptions ([#1948](https://github.com/googleapis/nodejs-pubsub/issues/1948)) ([120fa1b](https://github.com/googleapis/nodejs-pubsub/commit/120fa1bca0516185e109260c69ea91eb7ddeecd0))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **docs samples:** Update missing argv in sample metadata for push subscription ([#1946](https://github.com/googleapis/nodejs-pubsub/issues/1946)) ([34b8c03](https://github.com/googleapis/nodejs-pubsub/commit/34b8c03f90618ba6ae506764b9d97d9db84dcada))
26
+
7
27
  ## [4.5.0](https://github.com/googleapis/nodejs-pubsub/compare/v4.4.1...v4.5.0) (2024-06-11)
8
28
 
9
29
 
package/README.md CHANGED
@@ -131,6 +131,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree
131
131
  | Create Push Subscription | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createPushSubscription.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createPushSubscription.js,samples/README.md) |
132
132
  | Create Push Subscription With No Wrapper | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createPushSubscriptionNoWrapper.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createPushSubscriptionNoWrapper.js,samples/README.md) |
133
133
  | Create Subscription | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscription.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscription.js,samples/README.md) |
134
+ | Create a Cloud Storage subscription | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithCloudStorage.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithCloudStorage.js,samples/README.md) |
134
135
  | Create Subscription With Dead Letter Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithDeadLetterPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithDeadLetterPolicy.js,samples/README.md) |
135
136
  | Create an exactly-once delivery subscription | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithExactlyOnceDelivery.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithExactlyOnceDelivery.js,samples/README.md) |
136
137
  | Create Subscription With Filtering | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/createSubscriptionWithFiltering.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/createSubscriptionWithFiltering.js,samples/README.md) |
@@ -162,8 +163,8 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree
162
163
  | Listen with exactly-once delivery | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/listenForMessagesWithExactlyOnceDelivery.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/listenForMessagesWithExactlyOnceDelivery.js,samples/README.md) |
163
164
  | Listen For Protobuf Messages | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/listenForProtobufMessages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/listenForProtobufMessages.js,samples/README.md) |
164
165
  | Listen For Messages With Custom Attributes | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/listenWithCustomAttributes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/listenWithCustomAttributes.js,samples/README.md) |
166
+ | Subscribe with OpenTelemetry Tracing | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/listenWithOpenTelemetryTracing.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/listenWithOpenTelemetryTracing.js,samples/README.md) |
165
167
  | Modify Push Configuration | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/modifyPushConfig.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/modifyPushConfig.js,samples/README.md) |
166
- | OpenTelemetry Tracing | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/openTelemetryTracing.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/openTelemetryTracing.js,samples/README.md) |
167
168
  | Publish Avro Records to a Topic | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishAvroRecords.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishAvroRecords.js,samples/README.md) |
168
169
  | Publish Batched Messages | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishBatchedMessages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishBatchedMessages.js,samples/README.md) |
169
170
  | Publish Message | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishMessage.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishMessage.js,samples/README.md) |
@@ -171,6 +172,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-pubsub/tree
171
172
  | Publish Ordered Message | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishOrderedMessage.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishOrderedMessage.js,samples/README.md) |
172
173
  | Publish Protobuf Messages to a Topic | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishProtobufMessages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishProtobufMessages.js,samples/README.md) |
173
174
  | Publish with flow control | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishWithFlowControl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishWithFlowControl.js,samples/README.md) |
175
+ | Publish with OpenTelemetry Tracing | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishWithOpenTelemetryTracing.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishWithOpenTelemetryTracing.js,samples/README.md) |
174
176
  | Publish With Retry Settings | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/publishWithRetrySettings.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/publishWithRetrySettings.js,samples/README.md) |
175
177
  | Quickstart | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
176
178
  | Remove Dead Letter Policy | [source code](https://github.com/googleapis/nodejs-pubsub/blob/main/samples/removeDeadLetterPolicy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-pubsub&page=editor&open_in_editor=samples/removeDeadLetterPolicy.js,samples/README.md) |
@@ -1168,6 +1168,10 @@ message CloudStorageConfig {
1168
1168
  // data (for example, an ordering_key, if present) are added as entries in
1169
1169
  // the attributes map.
1170
1170
  bool write_metadata = 1 [(google.api.field_behavior) = OPTIONAL];
1171
+
1172
+ // Optional. When true, the output Cloud Storage file will be serialized
1173
+ // using the topic schema, if it exists.
1174
+ bool use_topic_schema = 2 [(google.api.field_behavior) = OPTIONAL];
1171
1175
  }
1172
1176
 
1173
1177
  // Possible states for a Cloud Storage subscription.
@@ -1188,6 +1192,10 @@ message CloudStorageConfig {
1188
1192
  // Cannot write to the destination because enforce_in_transit is set to true
1189
1193
  // and the destination locations are not in the allowed regions.
1190
1194
  IN_TRANSIT_LOCATION_RESTRICTION = 4;
1195
+
1196
+ // Cannot write to the Cloud Storage bucket due to an incompatibility
1197
+ // between the topic schema and subscription settings.
1198
+ SCHEMA_MISMATCH = 5;
1191
1199
  }
1192
1200
 
1193
1201
  // Required. User-provided name for the Cloud Storage bucket.
@@ -1232,6 +1240,10 @@ message CloudStorageConfig {
1232
1240
  // be exceeded in cases where messages are larger than the limit.
1233
1241
  int64 max_bytes = 7 [(google.api.field_behavior) = OPTIONAL];
1234
1242
 
1243
+ // Optional. The maximum number of messages that can be written to a Cloud
1244
+ // Storage file before a new file is created. Min 1000 messages.
1245
+ int64 max_messages = 8 [(google.api.field_behavior) = OPTIONAL];
1246
+
1235
1247
  // Output only. An output-only field that indicates whether or not the
1236
1248
  // subscription can receive messages.
1237
1249
  State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
@@ -3754,6 +3754,9 @@ export namespace google {
3754
3754
  /** CloudStorageConfig maxBytes */
3755
3755
  maxBytes?: (number|Long|string|null);
3756
3756
 
3757
+ /** CloudStorageConfig maxMessages */
3758
+ maxMessages?: (number|Long|string|null);
3759
+
3757
3760
  /** CloudStorageConfig state */
3758
3761
  state?: (google.pubsub.v1.CloudStorageConfig.State|keyof typeof google.pubsub.v1.CloudStorageConfig.State|null);
3759
3762
 
@@ -3794,6 +3797,9 @@ export namespace google {
3794
3797
  /** CloudStorageConfig maxBytes. */
3795
3798
  public maxBytes: (number|Long|string);
3796
3799
 
3800
+ /** CloudStorageConfig maxMessages. */
3801
+ public maxMessages: (number|Long|string);
3802
+
3797
3803
  /** CloudStorageConfig state. */
3798
3804
  public state: (google.pubsub.v1.CloudStorageConfig.State|keyof typeof google.pubsub.v1.CloudStorageConfig.State);
3799
3805
 
@@ -3979,6 +3985,9 @@ export namespace google {
3979
3985
 
3980
3986
  /** AvroConfig writeMetadata */
3981
3987
  writeMetadata?: (boolean|null);
3988
+
3989
+ /** AvroConfig useTopicSchema */
3990
+ useTopicSchema?: (boolean|null);
3982
3991
  }
3983
3992
 
3984
3993
  /** Represents an AvroConfig. */
@@ -3993,6 +4002,9 @@ export namespace google {
3993
4002
  /** AvroConfig writeMetadata. */
3994
4003
  public writeMetadata: boolean;
3995
4004
 
4005
+ /** AvroConfig useTopicSchema. */
4006
+ public useTopicSchema: boolean;
4007
+
3996
4008
  /**
3997
4009
  * Creates a new AvroConfig instance using the specified properties.
3998
4010
  * @param [properties] Properties to set
@@ -4077,7 +4089,8 @@ export namespace google {
4077
4089
  ACTIVE = 1,
4078
4090
  PERMISSION_DENIED = 2,
4079
4091
  NOT_FOUND = 3,
4080
- IN_TRANSIT_LOCATION_RESTRICTION = 4
4092
+ IN_TRANSIT_LOCATION_RESTRICTION = 4,
4093
+ SCHEMA_MISMATCH = 5
4081
4094
  }
4082
4095
  }
4083
4096
 
@@ -8672,6 +8672,7 @@
8672
8672
  * @property {google.pubsub.v1.CloudStorageConfig.IAvroConfig|null} [avroConfig] CloudStorageConfig avroConfig
8673
8673
  * @property {google.protobuf.IDuration|null} [maxDuration] CloudStorageConfig maxDuration
8674
8674
  * @property {number|Long|null} [maxBytes] CloudStorageConfig maxBytes
8675
+ * @property {number|Long|null} [maxMessages] CloudStorageConfig maxMessages
8675
8676
  * @property {google.pubsub.v1.CloudStorageConfig.State|null} [state] CloudStorageConfig state
8676
8677
  * @property {string|null} [serviceAccountEmail] CloudStorageConfig serviceAccountEmail
8677
8678
  */
@@ -8755,6 +8756,14 @@
8755
8756
  */
8756
8757
  CloudStorageConfig.prototype.maxBytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
8757
8758
 
8759
+ /**
8760
+ * CloudStorageConfig maxMessages.
8761
+ * @member {number|Long} maxMessages
8762
+ * @memberof google.pubsub.v1.CloudStorageConfig
8763
+ * @instance
8764
+ */
8765
+ CloudStorageConfig.prototype.maxMessages = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
8766
+
8758
8767
  /**
8759
8768
  * CloudStorageConfig state.
8760
8769
  * @member {google.pubsub.v1.CloudStorageConfig.State} state
@@ -8823,6 +8832,8 @@
8823
8832
  $root.google.protobuf.Duration.encode(message.maxDuration, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
8824
8833
  if (message.maxBytes != null && Object.hasOwnProperty.call(message, "maxBytes"))
8825
8834
  writer.uint32(/* id 7, wireType 0 =*/56).int64(message.maxBytes);
8835
+ if (message.maxMessages != null && Object.hasOwnProperty.call(message, "maxMessages"))
8836
+ writer.uint32(/* id 8, wireType 0 =*/64).int64(message.maxMessages);
8826
8837
  if (message.state != null && Object.hasOwnProperty.call(message, "state"))
8827
8838
  writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state);
8828
8839
  if (message.filenameDatetimeFormat != null && Object.hasOwnProperty.call(message, "filenameDatetimeFormat"))
@@ -8895,6 +8906,10 @@
8895
8906
  message.maxBytes = reader.int64();
8896
8907
  break;
8897
8908
  }
8909
+ case 8: {
8910
+ message.maxMessages = reader.int64();
8911
+ break;
8912
+ }
8898
8913
  case 9: {
8899
8914
  message.state = reader.int32();
8900
8915
  break;
@@ -8977,6 +8992,9 @@
8977
8992
  if (message.maxBytes != null && message.hasOwnProperty("maxBytes"))
8978
8993
  if (!$util.isInteger(message.maxBytes) && !(message.maxBytes && $util.isInteger(message.maxBytes.low) && $util.isInteger(message.maxBytes.high)))
8979
8994
  return "maxBytes: integer|Long expected";
8995
+ if (message.maxMessages != null && message.hasOwnProperty("maxMessages"))
8996
+ if (!$util.isInteger(message.maxMessages) && !(message.maxMessages && $util.isInteger(message.maxMessages.low) && $util.isInteger(message.maxMessages.high)))
8997
+ return "maxMessages: integer|Long expected";
8980
8998
  if (message.state != null && message.hasOwnProperty("state"))
8981
8999
  switch (message.state) {
8982
9000
  default:
@@ -8986,6 +9004,7 @@
8986
9004
  case 2:
8987
9005
  case 3:
8988
9006
  case 4:
9007
+ case 5:
8989
9008
  break;
8990
9009
  }
8991
9010
  if (message.serviceAccountEmail != null && message.hasOwnProperty("serviceAccountEmail"))
@@ -9038,6 +9057,15 @@
9038
9057
  message.maxBytes = object.maxBytes;
9039
9058
  else if (typeof object.maxBytes === "object")
9040
9059
  message.maxBytes = new $util.LongBits(object.maxBytes.low >>> 0, object.maxBytes.high >>> 0).toNumber();
9060
+ if (object.maxMessages != null)
9061
+ if ($util.Long)
9062
+ (message.maxMessages = $util.Long.fromValue(object.maxMessages)).unsigned = false;
9063
+ else if (typeof object.maxMessages === "string")
9064
+ message.maxMessages = parseInt(object.maxMessages, 10);
9065
+ else if (typeof object.maxMessages === "number")
9066
+ message.maxMessages = object.maxMessages;
9067
+ else if (typeof object.maxMessages === "object")
9068
+ message.maxMessages = new $util.LongBits(object.maxMessages.low >>> 0, object.maxMessages.high >>> 0).toNumber();
9041
9069
  switch (object.state) {
9042
9070
  default:
9043
9071
  if (typeof object.state === "number") {
@@ -9065,6 +9093,10 @@
9065
9093
  case 4:
9066
9094
  message.state = 4;
9067
9095
  break;
9096
+ case "SCHEMA_MISMATCH":
9097
+ case 5:
9098
+ message.state = 5;
9099
+ break;
9068
9100
  }
9069
9101
  if (object.serviceAccountEmail != null)
9070
9102
  message.serviceAccountEmail = String(object.serviceAccountEmail);
@@ -9094,6 +9126,11 @@
9094
9126
  object.maxBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
9095
9127
  } else
9096
9128
  object.maxBytes = options.longs === String ? "0" : 0;
9129
+ if ($util.Long) {
9130
+ var long = new $util.Long(0, 0, false);
9131
+ object.maxMessages = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
9132
+ } else
9133
+ object.maxMessages = options.longs === String ? "0" : 0;
9097
9134
  object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0;
9098
9135
  object.filenameDatetimeFormat = "";
9099
9136
  object.serviceAccountEmail = "";
@@ -9121,6 +9158,11 @@
9121
9158
  object.maxBytes = options.longs === String ? String(message.maxBytes) : message.maxBytes;
9122
9159
  else
9123
9160
  object.maxBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxBytes) : options.longs === Number ? new $util.LongBits(message.maxBytes.low >>> 0, message.maxBytes.high >>> 0).toNumber() : message.maxBytes;
9161
+ if (message.maxMessages != null && message.hasOwnProperty("maxMessages"))
9162
+ if (typeof message.maxMessages === "number")
9163
+ object.maxMessages = options.longs === String ? String(message.maxMessages) : message.maxMessages;
9164
+ else
9165
+ object.maxMessages = options.longs === String ? $util.Long.prototype.toString.call(message.maxMessages) : options.longs === Number ? new $util.LongBits(message.maxMessages.low >>> 0, message.maxMessages.high >>> 0).toNumber() : message.maxMessages;
9124
9166
  if (message.state != null && message.hasOwnProperty("state"))
9125
9167
  object.state = options.enums === String ? $root.google.pubsub.v1.CloudStorageConfig.State[message.state] === undefined ? message.state : $root.google.pubsub.v1.CloudStorageConfig.State[message.state] : message.state;
9126
9168
  if (message.filenameDatetimeFormat != null && message.hasOwnProperty("filenameDatetimeFormat"))
@@ -9338,6 +9380,7 @@
9338
9380
  * @memberof google.pubsub.v1.CloudStorageConfig
9339
9381
  * @interface IAvroConfig
9340
9382
  * @property {boolean|null} [writeMetadata] AvroConfig writeMetadata
9383
+ * @property {boolean|null} [useTopicSchema] AvroConfig useTopicSchema
9341
9384
  */
9342
9385
 
9343
9386
  /**
@@ -9363,6 +9406,14 @@
9363
9406
  */
9364
9407
  AvroConfig.prototype.writeMetadata = false;
9365
9408
 
9409
+ /**
9410
+ * AvroConfig useTopicSchema.
9411
+ * @member {boolean} useTopicSchema
9412
+ * @memberof google.pubsub.v1.CloudStorageConfig.AvroConfig
9413
+ * @instance
9414
+ */
9415
+ AvroConfig.prototype.useTopicSchema = false;
9416
+
9366
9417
  /**
9367
9418
  * Creates a new AvroConfig instance using the specified properties.
9368
9419
  * @function create
@@ -9389,6 +9440,8 @@
9389
9440
  writer = $Writer.create();
9390
9441
  if (message.writeMetadata != null && Object.hasOwnProperty.call(message, "writeMetadata"))
9391
9442
  writer.uint32(/* id 1, wireType 0 =*/8).bool(message.writeMetadata);
9443
+ if (message.useTopicSchema != null && Object.hasOwnProperty.call(message, "useTopicSchema"))
9444
+ writer.uint32(/* id 2, wireType 0 =*/16).bool(message.useTopicSchema);
9392
9445
  return writer;
9393
9446
  };
9394
9447
 
@@ -9427,6 +9480,10 @@
9427
9480
  message.writeMetadata = reader.bool();
9428
9481
  break;
9429
9482
  }
9483
+ case 2: {
9484
+ message.useTopicSchema = reader.bool();
9485
+ break;
9486
+ }
9430
9487
  default:
9431
9488
  reader.skipType(tag & 7);
9432
9489
  break;
@@ -9465,6 +9522,9 @@
9465
9522
  if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata"))
9466
9523
  if (typeof message.writeMetadata !== "boolean")
9467
9524
  return "writeMetadata: boolean expected";
9525
+ if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema"))
9526
+ if (typeof message.useTopicSchema !== "boolean")
9527
+ return "useTopicSchema: boolean expected";
9468
9528
  return null;
9469
9529
  };
9470
9530
 
@@ -9482,6 +9542,8 @@
9482
9542
  var message = new $root.google.pubsub.v1.CloudStorageConfig.AvroConfig();
9483
9543
  if (object.writeMetadata != null)
9484
9544
  message.writeMetadata = Boolean(object.writeMetadata);
9545
+ if (object.useTopicSchema != null)
9546
+ message.useTopicSchema = Boolean(object.useTopicSchema);
9485
9547
  return message;
9486
9548
  };
9487
9549
 
@@ -9498,10 +9560,14 @@
9498
9560
  if (!options)
9499
9561
  options = {};
9500
9562
  var object = {};
9501
- if (options.defaults)
9563
+ if (options.defaults) {
9502
9564
  object.writeMetadata = false;
9565
+ object.useTopicSchema = false;
9566
+ }
9503
9567
  if (message.writeMetadata != null && message.hasOwnProperty("writeMetadata"))
9504
9568
  object.writeMetadata = message.writeMetadata;
9569
+ if (message.useTopicSchema != null && message.hasOwnProperty("useTopicSchema"))
9570
+ object.useTopicSchema = message.useTopicSchema;
9505
9571
  return object;
9506
9572
  };
9507
9573
 
@@ -9543,6 +9609,7 @@
9543
9609
  * @property {number} PERMISSION_DENIED=2 PERMISSION_DENIED value
9544
9610
  * @property {number} NOT_FOUND=3 NOT_FOUND value
9545
9611
  * @property {number} IN_TRANSIT_LOCATION_RESTRICTION=4 IN_TRANSIT_LOCATION_RESTRICTION value
9612
+ * @property {number} SCHEMA_MISMATCH=5 SCHEMA_MISMATCH value
9546
9613
  */
9547
9614
  CloudStorageConfig.State = (function() {
9548
9615
  var valuesById = {}, values = Object.create(valuesById);
@@ -9551,6 +9618,7 @@
9551
9618
  values[valuesById[2] = "PERMISSION_DENIED"] = 2;
9552
9619
  values[valuesById[3] = "NOT_FOUND"] = 3;
9553
9620
  values[valuesById[4] = "IN_TRANSIT_LOCATION_RESTRICTION"] = 4;
9621
+ values[valuesById[5] = "SCHEMA_MISMATCH"] = 5;
9554
9622
  return values;
9555
9623
  })();
9556
9624
 
@@ -1,4 +1,7 @@
1
1
  {
2
+ "options": {
3
+ "syntax": "proto3"
4
+ },
2
5
  "nested": {
3
6
  "google": {
4
7
  "nested": {
@@ -1362,6 +1365,13 @@
1362
1365
  "(google.api.field_behavior)": "OPTIONAL"
1363
1366
  }
1364
1367
  },
1368
+ "maxMessages": {
1369
+ "type": "int64",
1370
+ "id": 8,
1371
+ "options": {
1372
+ "(google.api.field_behavior)": "OPTIONAL"
1373
+ }
1374
+ },
1365
1375
  "state": {
1366
1376
  "type": "State",
1367
1377
  "id": 9,
@@ -1389,6 +1399,13 @@
1389
1399
  "options": {
1390
1400
  "(google.api.field_behavior)": "OPTIONAL"
1391
1401
  }
1402
+ },
1403
+ "useTopicSchema": {
1404
+ "type": "bool",
1405
+ "id": 2,
1406
+ "options": {
1407
+ "(google.api.field_behavior)": "OPTIONAL"
1408
+ }
1392
1409
  }
1393
1410
  }
1394
1411
  },
@@ -1398,7 +1415,8 @@
1398
1415
  "ACTIVE": 1,
1399
1416
  "PERMISSION_DENIED": 2,
1400
1417
  "NOT_FOUND": 3,
1401
- "IN_TRANSIT_LOCATION_RESTRICTION": 4
1418
+ "IN_TRANSIT_LOCATION_RESTRICTION": 4,
1419
+ "SCHEMA_MISMATCH": 5
1402
1420
  }
1403
1421
  }
1404
1422
  }
@@ -13,7 +13,8 @@
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.processAckRpcError = exports.processAckErrorInfo = void 0;
16
+ exports.processAckErrorInfo = processAckErrorInfo;
17
+ exports.processAckRpcError = processAckRpcError;
17
18
  const google_gax_1 = require("google-gax");
18
19
  const subscriber_1 = require("./subscriber");
19
20
  const permanentFailureInvalidAckId = 'PERMANENT_FAILURE_INVALID_ACK_ID';
@@ -64,7 +65,6 @@ function processAckErrorInfo(rpcError) {
64
65
  }
65
66
  return ret;
66
67
  }
67
- exports.processAckErrorInfo = processAckErrorInfo;
68
68
  /**
69
69
  * For a completely failed RPC call, this will find the appropriate
70
70
  * error information to return to an ack() caller.
@@ -89,5 +89,4 @@ function processAckRpcError(grpcCode) {
89
89
  }
90
90
  return ackError;
91
91
  }
92
- exports.processAckRpcError = processAckRpcError;
93
92
  //# sourceMappingURL=ack-metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ack-metadata.js","sourceRoot":"","sources":["../../src/ack-metadata.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,2CAA+C;AAC/C,6CAAuD;AAEvD,MAAM,4BAA4B,GAAG,kCAAkC,CAAC;AACxE,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,uCAAuC,GAAG;IAC9C,mBAAM,CAAC,iBAAiB;IACxB,mBAAM,CAAC,kBAAkB;IACzB,mBAAM,CAAC,OAAO;IACd,mBAAM,CAAC,QAAQ;IACf,mBAAM,CAAC,WAAW;CACnB,CAAC;AAwBF;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,QAAqB;IACvD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAwB,CAAC;IAE5C,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,2DAA2D;IAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAmC,CAAC;IAE9D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,IAAI,KAAK,4BAA4B,EAAE,CAAC;YAC1C,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE;gBACb,SAAS,EAAE,K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AAC,GAAG,CAAC,KAAK,EAAE;gBACb,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,yBAAY,CAAC,KAAK;gBAC5B,YAAY,EAAE,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,MAAM,QAAQ,GAAiB;QAC7B,SAAS,EAAE,uCAAuC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACrE,aAAa,EAAE,QAAQ;KACxB,CAAC;IACF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,mBAAM,CAAC,iBAAiB;YAC3B,QAAQ,CAAC,QAAQ,GAAG,yBAAY,CAAC,gBAAgB,CAAC;YAClD,MAAM;QACR,KAAK,mBAAM,CAAC,mBAAmB;YAC7B,QAAQ,CAAC,QAAQ,GAAG,yBAAY,CAAC,kBAAkB,CAAC;YACpD,MAAM;QACR;YACE,QAAQ,CAAC,QAAQ,GAAG,yBAAY,CAAC,KAAK,CAAC;YACvC,MAAM;IACV,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /// <reference types="node" />
17
16
  import { CallOptions, IamProtos } from 'google-gax';
18
17
  import { Omit, PubSub, RequestCallback, ResourceCallback } from './pubsub';
19
18
  export type Policy = {
@@ -23,6 +22,14 @@ export type GetPolicyCallback = RequestCallback<Policy>;
23
22
  export type SetPolicyCallback = RequestCallback<Policy>;
24
23
  export type SetPolicyResponse = [Policy];
25
24
  export type GetPolicyResponse = [Policy];
25
+ /**
26
+ * Allows us to get the most up to date full name of an object.
27
+ *
28
+ * @private
29
+ */
30
+ export interface Nameable {
31
+ name: string;
32
+ }
26
33
  /**
27
34
  * Shows which IAM permissions is allowed.
28
35
  * The key to this object are the IAM permissions (string) and the values are
@@ -79,8 +86,9 @@ export type TestIamPermissionsCallback = ResourceCallback<IamPermissionsMap, Iam
79
86
  export declare class IAM {
80
87
  pubsub: PubSub;
81
88
  request: typeof PubSub.prototype.request;
82
- id: string;
83
- constructor(pubsub: PubSub, id: string);
89
+ private nameable_;
90
+ constructor(pubsub: PubSub, nameOrNameable: Nameable | string);
91
+ get id(): string;
84
92
  /**
85
93
  * @typedef {array} GetPolicyResponse
86
94
  * @property {object} 0 The policy.
package/build/src/iam.js CHANGED
@@ -62,10 +62,20 @@ const util_1 = require("./util");
62
62
  * ```
63
63
  */
64
64
  class IAM {
65
- constructor(pubsub, id) {
65
+ constructor(pubsub, nameOrNameable) {
66
66
  this.pubsub = pubsub;
67
67
  this.request = pubsub.request.bind(pubsub);
68
- this.id = id;
68
+ if (typeof nameOrNameable === 'string') {
69
+ this.nameable_ = {
70
+ name: nameOrNameable,
71
+ };
72
+ }
73
+ else {
74
+ this.nameable_ = nameOrNameable;
75
+ }
76
+ }
77
+ get id() {
78
+ return this.nameable_.name;
69
79
  }
70
80
  getPolicy(optsOrCallback, callback) {
71
81
  const gaxOpts = typeof optsOrCallback === 'object' ? optsOrCallback : {};
@@ -1 +1 @@
1
- {"version":3,"file":"iam.js","sourceRoot":"","sources":["../../src/iam.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AAEH,iCAAkC;AAIlC,iCAAqC;AA8BrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,GAAG;IAKd,YAAY,MAAc,EAAE,EAAU;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IA8CD,SAAS,CACP,cAAgD,EAChD,QAA4B;QAE5B,MAAM,OAAO,GAAG,OAAO,cAAc,KA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IAAK,CAAC,WAAY,CAAC,CAAC;YACxD,MAAM,cAAc,GAClB,WACD,CAAC,MAAM,CACN,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;gBAClB,GAAG,CAAC,UAAU,CAAC,GAAG,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChE,OAAO,GAAG,CAAC;YACb,CAAC,EACD,EAA8B,CAC/B,CAAC;YACF,QAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAK,CAAC,CAAC;QACzC,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA5TD,kBA4TC;AAED;;;;;GAKG;AACH,IAAA,oBAAa,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE;IAChC,WAAW;IACX,WAAW;IACX,iBAAiB;CAClB,CAAC,CAAC"}
@@ -98,3 +98,5 @@ export { Duration, TotalOfUnit, DurationLike } from './temporal';
98
98
  export { DebugMessage } from './debug';
99
99
  import * as protos from '../protos/protos';
100
100
  export { protos };
101
+ import { legacyExports } from './telemetry-tracing';
102
+ export { legacyExports as openTelemetry };
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.protos = exports.DebugMessage = exports.Duration = exports.Topic = exports.AckResponses = exports.AckError = exports.Subscription = exports.Encodings = exports.SchemaViews = exports.SchemaTypes = exports.Schema = exports.Message = exports.Snapshot = exports.PubSub = exports.PublishError = exports.IAM = exports.v1 = void 0;
18
+ exports.openTelemetry = exports.protos = exports.DebugMessage = exports.Duration = exports.Topic = exports.AckResponses = exports.AckError = exports.Subscription = exports.Encodings = exports.SchemaViews = exports.SchemaTypes = exports.Schema = exports.Message = exports.Snapshot = exports.PubSub = exports.PublishError = exports.IAM = exports.v1 = void 0;
19
19
  /**
20
20
  * @namespace google.pubsub.v1
21
21
  */
@@ -118,4 +118,8 @@ if (process.env.DEBUG_GRPC) {
118
118
  }
119
119
  const protos = require("../protos/protos");
120
120
  exports.protos = protos;
121
+ // Deprecated; please see the updated OpenTelemetry sample
122
+ // for an example of how to use telemetry in this library.
123
+ const telemetry_tracing_1 = require("./telemetry-tracing");
124
+ Object.defineProperty(exports, "openTelemetry", { enumerable: true, get: function () { return telemetry_tracing_1.legacyExports; } });
121
125
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;GAWG;AACH,2BAA2B;AACnB,gBAAE;AAEV,6BAUe;AADb,0FAAA,GAAG,OAAA;AAIL,2DAAuD;AAA/C,6GAAA,YAAY,OAAA;AAEpB,mCAckB;AAFhB,gGAAA,MAAM,OAAA;AAGR,uCAMoB;AADlB,oGAAA,QAAQ,OAAA;AAEV,2CAAwD;AAAhD,qGAAA,OAAO,OAAA;AACf,mCAYkB;AAXhB,gGAAA,MAAM,OAAA;AAIN,qGAAA,WAAW,OAAA;AAIX,qGAAA,WAAW,OAAA;AACX,mGAAA,SAAS,OAAA;AAGX,+CAmBwB;AAJtB,4GAAA,YAAY,OAAA;AACZ,wGAAA,QAAQ,OAAA;AAER,4GAAA,YAAY,OAAA;AAEd,iCAciB;AAFf,8FAAA,KAAK,OAAA;AAGP,uCAA+D;AAAvD,oGAAA,QAAQ,OAAA;AAChB,iCAAqC;AAA7B,qGAAA,YAAY,OAAA;AAEpB,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;IACxC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACx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D;AAC1D,0DAA0D;AAC1D,2DAAkD;AACzB,8FADjB,iCAAa,OACiB"}
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /// <reference types="node" />
17
16
  import { EventEmitter } from 'events';
18
17
  import { Message, Subscriber } from './subscriber';
19
18
  export interface FlowControlOptions {
@@ -81,10 +80,10 @@ export declare class LeaseManager extends EventEmitter {
81
80
  */
82
81
  add(message: Message): void;
83
82
  /**
84
- * Removes ALL messages from inventory.
83
+ * Removes ALL messages from inventory, and returns the ones removed.
85
84
  * @private
86
85
  */
87
- clear(): void;
86
+ clear(): Message[];
88
87
  /**
89
88
  * Indicates if we're at or over capacity.
90
89
  *
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.LeaseManager = void 0;
19
19
  const events_1 = require("events");
20
20
  const default_options_1 = require("./default-options");
21
+ const temporal_1 = require("./temporal");
21
22
  /**
22
23
  * @typedef {object} FlowControlOptions
23
24
  * @property {boolean} [allowExcessMessages=true] PubSub delivers messages in
@@ -83,6 +84,7 @@ class LeaseManager extends events_1.EventEmitter {
83
84
  const wasFull = this.isFull();
84
85
  this._messages.add(message);
85
86
  this.bytes += message.length;
87
+ message.subSpans.flowStart();
86
88
  if (allowExcessMessages || !wasFull) {
87
89
  this._dispense(message);
88
90
  }
@@ -98,18 +100,20 @@ class LeaseManager extends events_1.EventEmitter {
98
100
  }
99
101
  }
100
102
  /**
101
- * Removes ALL messages from inventory.
103
+ * Removes ALL messages from inventory, and returns the ones removed.
102
104
  * @private
103
105
  */
104
106
  clear() {
105
107
  const wasFull = this.isFull();
106
108
  this._pending = [];
109
+ const remaining = Array.from(this._messages);
107
110
  this._messages.clear();
108
111
  this.bytes = 0;
109
112
  if (wasFull) {
110
113
  process.nextTick(() => this.emit('free'));
111
114
  }
112
115
  this._cancelExtension();
116
+ return remaining;
113
117
  }
114
118
  /**
115
119
  * Indicates if we're at or over capacity.
@@ -204,7 +208,11 @@ class LeaseManager extends events_1.EventEmitter {
204
208
  */
205
209
  _dispense(message) {
206
210
  if (this._subscriber.isOpen) {
207
- process.nextTick(() => this._subscriber.emit('message', message));
211
+ message.subSpans.flowEnd();
212
+ process.nextTick(() => {
213
+ message.subSpans.processingStart(this._subscriber.name);
214
+ this._subscriber.emit('message', message);
215
+ });
208
216
  }
209
217
  }
210
218
  /**
@@ -219,16 +227,24 @@ class LeaseManager extends events_1.EventEmitter {
219
227
  // Lifespan here is in minutes.
220
228
  const lifespan = (Date.now() - message.received) / (60 * 1000);
221
229
  if (lifespan < this._options.maxExtensionMinutes) {
230
+ const deadlineDuration = temporal_1.Duration.from({ seconds: deadline });
231
+ message.subSpans.modAckStart(deadlineDuration, false);
222
232
  if (this._subscriber.isExactlyOnceDelivery) {
223
- message.modAckWithResponse(deadline).catch(e => {
233
+ message
234
+ .modAckWithResponse(deadline)
235
+ .catch(e => {
224
236
  // In the case of a permanent failure (temporary failures are retried),
225
237
  // we need to stop trying to lease-manage the message.
226
238
  message.ackFailed(e);
227
239
  this.remove(message);
240
+ })
241
+ .finally(() => {
242
+ message.subSpans.modAckEnd();
228
243
  });
229
244
  }
230
245
  else {
231
246
  message.modAck(deadline);
247
+ message.subSpans.modAckStart(deadlineDuration, false);
232
248
  }
233
249
  }
234
250
  else {