@event-driven-io/emmett-postgresql 0.42.0-rc.1 → 0.42.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.
package/dist/index.cjs CHANGED
@@ -892,10 +892,10 @@ var zipPostgreSQLEventStoreMessageBatchPullerStartFrom = (options) => {
892
892
 
893
893
  require('pg');
894
894
 
895
- // src/eventStore/projections/locks/tryAcquireProcessorLock.ts
895
+ // src/eventStore/projections/locks/tryAcquireProjectionLock.ts
896
896
 
897
897
 
898
- // src/eventStore/schema/processors/processorsLocks.ts
898
+ // src/eventStore/schema/projections/projectionsLocks.ts
899
899
 
900
900
 
901
901
  // src/eventStore/schema/createFunctionIfDoesNotExist.ts
@@ -911,7 +911,97 @@ END $$;
911
911
  `
912
912
  );
913
913
 
914
+ // src/eventStore/schema/projections/projectionsLocks.ts
915
+ var tryAcquireProjectionLockSQL = createFunctionIfDoesNotExistSQL(
916
+ "emt_try_acquire_projection_lock",
917
+ `
918
+ CREATE OR REPLACE FUNCTION emt_try_acquire_projection_lock(
919
+ p_lock_key BIGINT,
920
+ p_partition TEXT,
921
+ p_name TEXT,
922
+ p_version INT
923
+ )
924
+ RETURNS TABLE (acquired BOOLEAN, is_active BOOLEAN)
925
+ LANGUAGE plpgsql
926
+ AS $emt_try_acquire_projection_lock$
927
+ BEGIN
928
+ RETURN QUERY
929
+ WITH lock_check AS (
930
+ SELECT pg_try_advisory_xact_lock_shared(p_lock_key) AS acquired
931
+ ),
932
+ status_check AS (
933
+ SELECT status = 'active' AS is_active
934
+ FROM ${projectionsTable.name}
935
+ WHERE partition = p_partition AND name = p_name AND version = p_version
936
+ )
937
+ SELECT
938
+ COALESCE((SELECT lc.acquired FROM lock_check lc), false),
939
+ COALESCE((SELECT sc.is_active FROM status_check sc), true);
940
+ END;
941
+ $emt_try_acquire_projection_lock$;
942
+ `
943
+ );
944
+ var callTryAcquireProjectionLock = (params) => _dumbo.sql.call(void 0,
945
+ `SELECT * FROM emt_try_acquire_projection_lock(%s::BIGINT, %L, %L, %s);`,
946
+ params.lockKey,
947
+ params.partition,
948
+ params.name,
949
+ params.version
950
+ );
951
+
952
+ // src/eventStore/projections/locks/tryAcquireProjectionLock.ts
953
+ var tryAcquireProjectionLock = async (execute, {
954
+ lockKey,
955
+ projectionName,
956
+ partition,
957
+ version
958
+ }) => {
959
+ const lockKeyBigInt = isBigint(lockKey) ? lockKey : await hashText(lockKey);
960
+ const { acquired, is_active } = await _dumbo.single.call(void 0,
961
+ execute.query(
962
+ callTryAcquireProjectionLock({
963
+ lockKey: lockKeyBigInt.toString(),
964
+ partition,
965
+ name: projectionName,
966
+ version
967
+ })
968
+ )
969
+ );
970
+ return acquired === true && is_active === true;
971
+ };
972
+
973
+ // src/eventStore/projections/locks/postgreSQLProjectionLock.ts
974
+ var postgreSQLProjectionLock = (options) => {
975
+ let acquired = false;
976
+ const lockKey = _nullishCoalesce(options.lockKey, () => ( toProjectionLockKey(options)));
977
+ return {
978
+ tryAcquire: async (context) => {
979
+ if (acquired) {
980
+ return true;
981
+ }
982
+ acquired = await tryAcquireProjectionLock(context.execute, {
983
+ ...options,
984
+ lockKey
985
+ });
986
+ return acquired;
987
+ },
988
+ release: (_context) => {
989
+ if (!acquired) return;
990
+ acquired = false;
991
+ }
992
+ };
993
+ };
994
+ var toProjectionLockKey = ({
995
+ projectionName,
996
+ partition,
997
+ version
998
+ }) => `${partition}:${projectionName}:${version}`;
999
+
1000
+ // src/eventStore/projections/locks/tryAcquireProcessorLock.ts
1001
+
1002
+
914
1003
  // src/eventStore/schema/processors/processorsLocks.ts
1004
+
915
1005
  var tryAcquireProcessorLockSQL = createFunctionIfDoesNotExistSQL(
916
1006
  "emt_try_acquire_processor_lock",
917
1007
  `
@@ -1070,7 +1160,7 @@ var tryAcquireProcessorLock = async (execute, options) => {
1070
1160
  return acquired ? { acquired: true, checkpoint } : { acquired: false };
1071
1161
  };
1072
1162
  var tryAcquireProcessorLockWithRetry = async (execute, options) => {
1073
- const policy = _nullishCoalesce(options.lockPolicy, () => ( DefaultPostgreSQLProcessorLockPolicy));
1163
+ const policy = _nullishCoalesce(options.lockAcquisitionPolicy, () => ( DefaultPostgreSQLProcessorLockPolicy));
1074
1164
  if (policy.type === "retry") {
1075
1165
  return asyncRetry(() => tryAcquireProcessorLock(execute, options), {
1076
1166
  retries: policy.retries - 1,
@@ -1098,96 +1188,6 @@ var releaseProcessorLock = async (execute, options) => {
1098
1188
  return result;
1099
1189
  };
1100
1190
 
1101
- // src/eventStore/projections/locks/tryAcquireProjectionLock.ts
1102
-
1103
-
1104
- // src/eventStore/schema/projections/projectionsLocks.ts
1105
-
1106
- var tryAcquireProjectionLockSQL = createFunctionIfDoesNotExistSQL(
1107
- "emt_try_acquire_projection_lock",
1108
- `
1109
- CREATE OR REPLACE FUNCTION emt_try_acquire_projection_lock(
1110
- p_lock_key BIGINT,
1111
- p_partition TEXT,
1112
- p_name TEXT,
1113
- p_version INT
1114
- )
1115
- RETURNS TABLE (acquired BOOLEAN, is_active BOOLEAN)
1116
- LANGUAGE plpgsql
1117
- AS $emt_try_acquire_projection_lock$
1118
- BEGIN
1119
- RETURN QUERY
1120
- WITH lock_check AS (
1121
- SELECT pg_try_advisory_xact_lock_shared(p_lock_key) AS acquired
1122
- ),
1123
- status_check AS (
1124
- SELECT status = 'active' AS is_active
1125
- FROM ${projectionsTable.name}
1126
- WHERE partition = p_partition AND name = p_name AND version = p_version
1127
- )
1128
- SELECT
1129
- COALESCE((SELECT lc.acquired FROM lock_check lc), false),
1130
- COALESCE((SELECT sc.is_active FROM status_check sc), true);
1131
- END;
1132
- $emt_try_acquire_projection_lock$;
1133
- `
1134
- );
1135
- var callTryAcquireProjectionLock = (params) => _dumbo.sql.call(void 0,
1136
- `SELECT * FROM emt_try_acquire_projection_lock(%s::BIGINT, %L, %L, %s);`,
1137
- params.lockKey,
1138
- params.partition,
1139
- params.name,
1140
- params.version
1141
- );
1142
-
1143
- // src/eventStore/projections/locks/tryAcquireProjectionLock.ts
1144
- var tryAcquireProjectionLock = async (execute, {
1145
- lockKey,
1146
- projectionName,
1147
- partition,
1148
- version
1149
- }) => {
1150
- const lockKeyBigInt = isBigint(lockKey) ? lockKey : await hashText(lockKey);
1151
- const { acquired, is_active } = await _dumbo.single.call(void 0,
1152
- execute.query(
1153
- callTryAcquireProjectionLock({
1154
- lockKey: lockKeyBigInt.toString(),
1155
- partition,
1156
- name: projectionName,
1157
- version
1158
- })
1159
- )
1160
- );
1161
- return acquired === true && is_active === true;
1162
- };
1163
-
1164
- // src/eventStore/projections/locks/postgreSQLProjectionLock.ts
1165
- var postgreSQLProjectionLock = (options) => {
1166
- let acquired = false;
1167
- const lockKey = _nullishCoalesce(options.lockKey, () => ( toProjectionLockKey(options)));
1168
- return {
1169
- tryAcquire: async (context) => {
1170
- if (acquired) {
1171
- return true;
1172
- }
1173
- acquired = await tryAcquireProjectionLock(context.execute, {
1174
- ...options,
1175
- lockKey
1176
- });
1177
- return acquired;
1178
- },
1179
- release: (_context) => {
1180
- if (!acquired) return;
1181
- acquired = false;
1182
- }
1183
- };
1184
- };
1185
- var toProjectionLockKey = ({
1186
- projectionName,
1187
- partition,
1188
- version
1189
- }) => `${partition}:${projectionName}:${version}`;
1190
-
1191
1191
  // src/eventStore/projections/locks/postgreSQLProcessorLock.ts
1192
1192
  var DefaultPostgreSQLProcessorLockPolicy = {
1193
1193
  type: "fail"
@@ -1204,7 +1204,7 @@ var postgreSQLProcessorLock = (options) => {
1204
1204
  ...options,
1205
1205
  lockKey
1206
1206
  });
1207
- if (!result.acquired && _optionalChain([options, 'access', _45 => _45.lockPolicy, 'optionalAccess', _46 => _46.type]) !== "skip") {
1207
+ if (!result.acquired && _optionalChain([options, 'access', _45 => _45.lockAcquisitionPolicy, 'optionalAccess', _46 => _46.type]) !== "skip") {
1208
1208
  throw new EmmettError(
1209
1209
  `Failed to acquire lock for processor '${options.processorId}'`
1210
1210
  );
@@ -1589,7 +1589,7 @@ var pongoMultiStreamProjection = (options) => {
1589
1589
  await pongo.db().collection(
1590
1590
  collectionNameWithVersion,
1591
1591
  options.collectionOptions
1592
- ).schema.migrate();
1592
+ ).schema.migrate(context.migrationOptions);
1593
1593
  } finally {
1594
1594
  await pongo.close();
1595
1595
  }
@@ -4166,8 +4166,8 @@ var eventStoreSchemaMigrations = [
4166
4166
  migration_0_42_0_2_AddProcessorProjectionFunctions,
4167
4167
  schemaMigration
4168
4168
  ];
4169
- var createEventStoreSchema = async (connectionString, pool, hooks) => {
4170
- await pool.withTransaction(async (tx) => {
4169
+ var createEventStoreSchema = (connectionString, pool, hooks, options) => {
4170
+ return pool.withTransaction(async (tx) => {
4171
4171
  const client = await tx.connection.open();
4172
4172
  const context = {
4173
4173
  execute: tx.execute,
@@ -4183,10 +4183,15 @@ var createEventStoreSchema = async (connectionString, pool, hooks) => {
4183
4183
  if (_optionalChain([hooks, 'optionalAccess', _65 => _65.onBeforeSchemaCreated])) {
4184
4184
  await hooks.onBeforeSchemaCreated(context);
4185
4185
  }
4186
- await _dumbo.runPostgreSQLMigrations.call(void 0, nestedPool, eventStoreSchemaMigrations);
4186
+ const result = await _dumbo.runPostgreSQLMigrations.call(void 0,
4187
+ nestedPool,
4188
+ eventStoreSchemaMigrations,
4189
+ options
4190
+ );
4187
4191
  if (_optionalChain([hooks, 'optionalAccess', _66 => _66.onAfterSchemaCreated])) {
4188
4192
  await hooks.onAfterSchemaCreated(context);
4189
4193
  }
4194
+ return result;
4190
4195
  } finally {
4191
4196
  await nestedPool.close();
4192
4197
  }
@@ -4218,30 +4223,35 @@ var getPostgreSQLEventStore = (connectionString, options = defaultPostgreSQLOpti
4218
4223
  let migrateSchema = void 0;
4219
4224
  const autoGenerateSchema = _optionalChain([options, 'access', _68 => _68.schema, 'optionalAccess', _69 => _69.autoMigration]) === void 0 || _optionalChain([options, 'access', _70 => _70.schema, 'optionalAccess', _71 => _71.autoMigration]) !== "None";
4220
4225
  const inlineProjections = (_nullishCoalesce(options.projections, () => ( []))).filter(({ type }) => type === "inline").map(({ projection: projection2 }) => projection2);
4221
- const migrate = async () => {
4226
+ const migrate = async (migrationOptions) => {
4222
4227
  if (!migrateSchema) {
4223
- migrateSchema = createEventStoreSchema(connectionString, pool, {
4224
- onBeforeSchemaCreated: async (context) => {
4225
- if (_optionalChain([options, 'access', _72 => _72.hooks, 'optionalAccess', _73 => _73.onBeforeSchemaCreated])) {
4226
- await options.hooks.onBeforeSchemaCreated(context);
4227
- }
4228
- },
4229
- onAfterSchemaCreated: async (context) => {
4230
- for (const projection2 of inlineProjections) {
4231
- if (projection2.init) {
4232
- await projection2.init({
4233
- version: _nullishCoalesce(projection2.version, () => ( 1)),
4234
- status: "active",
4235
- registrationType: "inline",
4236
- context
4237
- });
4228
+ migrateSchema = createEventStoreSchema(
4229
+ connectionString,
4230
+ pool,
4231
+ {
4232
+ onBeforeSchemaCreated: async (context) => {
4233
+ if (_optionalChain([options, 'access', _72 => _72.hooks, 'optionalAccess', _73 => _73.onBeforeSchemaCreated])) {
4234
+ await options.hooks.onBeforeSchemaCreated(context);
4235
+ }
4236
+ },
4237
+ onAfterSchemaCreated: async (context) => {
4238
+ for (const projection2 of inlineProjections) {
4239
+ if (projection2.init) {
4240
+ await projection2.init({
4241
+ version: _nullishCoalesce(projection2.version, () => ( 1)),
4242
+ status: "active",
4243
+ registrationType: "inline",
4244
+ context: { ...context, migrationOptions }
4245
+ });
4246
+ }
4247
+ }
4248
+ if (_optionalChain([options, 'access', _74 => _74.hooks, 'optionalAccess', _75 => _75.onAfterSchemaCreated])) {
4249
+ await options.hooks.onAfterSchemaCreated(context);
4238
4250
  }
4239
4251
  }
4240
- if (_optionalChain([options, 'access', _74 => _74.hooks, 'optionalAccess', _75 => _75.onAfterSchemaCreated])) {
4241
- await options.hooks.onAfterSchemaCreated(context);
4242
- }
4243
- }
4244
- });
4252
+ },
4253
+ migrationOptions
4254
+ );
4245
4255
  }
4246
4256
  return migrateSchema;
4247
4257
  };
@@ -4713,8 +4723,7 @@ var postgreSQLProjector = (options) => {
4713
4723
  processorInstanceId = getProcessorInstanceId(processorId),
4714
4724
  version = defaultProcessorVersion,
4715
4725
  partition = defaultProcessorPartition,
4716
- lockPolicy = DefaultPostgreSQLProcessorLockPolicy,
4717
- lockTimeoutSeconds
4726
+ lock
4718
4727
  } = options;
4719
4728
  const { pool, connectionString, close } = getProcessorPool(options);
4720
4729
  const processorLock = postgreSQLProcessorLock({
@@ -4728,26 +4737,33 @@ var postgreSQLProjector = (options) => {
4728
4737
  version: _nullishCoalesce(options.projection.version, () => ( version)),
4729
4738
  handlingType: "async"
4730
4739
  } : void 0,
4731
- lockPolicy,
4732
- lockTimeoutSeconds
4740
+ lockAcquisitionPolicy: _nullishCoalesce(_optionalChain([lock, 'optionalAccess', _98 => _98.acquisitionPolicy]), () => ( DefaultPostgreSQLProcessorLockPolicy)),
4741
+ lockTimeoutSeconds: _optionalChain([lock, 'optionalAccess', _99 => _99.timeoutSeconds])
4733
4742
  });
4734
4743
  const hooks = wrapHooksWithProcessorLocks(
4735
4744
  {
4736
4745
  ..._nullishCoalesce(options.hooks, () => ( {})),
4737
- onInit: options.projection.init !== void 0 || _optionalChain([options, 'access', _98 => _98.hooks, 'optionalAccess', _99 => _99.onInit]) ? async (context) => {
4746
+ onInit: options.projection.init !== void 0 || _optionalChain([options, 'access', _100 => _100.hooks, 'optionalAccess', _101 => _101.onInit]) ? async (context) => {
4738
4747
  if (options.projection.init)
4739
4748
  await options.projection.init({
4740
4749
  version: _nullishCoalesce(options.projection.version, () => ( version)),
4741
4750
  status: "active",
4742
4751
  registrationType: "async",
4743
- context
4752
+ context: {
4753
+ ...context,
4754
+ migrationOptions: options.migrationOptions
4755
+ }
4756
+ });
4757
+ if (_optionalChain([options, 'access', _102 => _102.hooks, 'optionalAccess', _103 => _103.onInit]))
4758
+ await options.hooks.onInit({
4759
+ ...context,
4760
+ migrationOptions: options.migrationOptions
4744
4761
  });
4745
- if (_optionalChain([options, 'access', _100 => _100.hooks, 'optionalAccess', _101 => _101.onInit])) await options.hooks.onInit(context);
4746
- } : _optionalChain([options, 'access', _102 => _102.hooks, 'optionalAccess', _103 => _103.onInit]),
4762
+ } : _optionalChain([options, 'access', _104 => _104.hooks, 'optionalAccess', _105 => _105.onInit]),
4747
4763
  onClose: close ? async (context) => {
4748
- if (_optionalChain([options, 'access', _104 => _104.hooks, 'optionalAccess', _105 => _105.onClose])) await _optionalChain([options, 'access', _106 => _106.hooks, 'optionalAccess', _107 => _107.onClose, 'call', _108 => _108(context)]);
4764
+ if (_optionalChain([options, 'access', _106 => _106.hooks, 'optionalAccess', _107 => _107.onClose])) await _optionalChain([options, 'access', _108 => _108.hooks, 'optionalAccess', _109 => _109.onClose, 'call', _110 => _110(context)]);
4749
4765
  if (close) await close();
4750
- } : _optionalChain([options, 'access', _109 => _109.hooks, 'optionalAccess', _110 => _110.onClose])
4766
+ } : _optionalChain([options, 'access', _111 => _111.hooks, 'optionalAccess', _112 => _112.onClose])
4751
4767
  },
4752
4768
  processorLock
4753
4769
  );
@@ -4774,7 +4790,7 @@ var postgreSQLReactor = (options) => {
4774
4790
  processorInstanceId = getProcessorInstanceId(processorId),
4775
4791
  version = defaultProcessorVersion,
4776
4792
  partition = defaultProcessorPartition,
4777
- lockPolicy = DefaultPostgreSQLProcessorLockPolicy
4793
+ lock
4778
4794
  } = options;
4779
4795
  const { pool, connectionString, close } = getProcessorPool(options);
4780
4796
  const processorLock = postgreSQLProcessorLock({
@@ -4783,15 +4799,16 @@ var postgreSQLReactor = (options) => {
4783
4799
  partition,
4784
4800
  processorInstanceId,
4785
4801
  projection: void 0,
4786
- lockPolicy
4802
+ lockAcquisitionPolicy: _nullishCoalesce(_optionalChain([lock, 'optionalAccess', _113 => _113.acquisitionPolicy]), () => ( DefaultPostgreSQLProcessorLockPolicy)),
4803
+ lockTimeoutSeconds: _optionalChain([lock, 'optionalAccess', _114 => _114.timeoutSeconds])
4787
4804
  });
4788
4805
  const hooks = wrapHooksWithProcessorLocks(
4789
4806
  {
4790
4807
  ..._nullishCoalesce(options.hooks, () => ( {})),
4791
4808
  onClose: close ? async (context) => {
4792
- if (_optionalChain([options, 'access', _111 => _111.hooks, 'optionalAccess', _112 => _112.onClose])) await _optionalChain([options, 'access', _113 => _113.hooks, 'optionalAccess', _114 => _114.onClose, 'call', _115 => _115(context)]);
4809
+ if (_optionalChain([options, 'access', _115 => _115.hooks, 'optionalAccess', _116 => _116.onClose])) await _optionalChain([options, 'access', _117 => _117.hooks, 'optionalAccess', _118 => _118.onClose, 'call', _119 => _119(context)]);
4793
4810
  if (close) await close();
4794
- } : _optionalChain([options, 'access', _116 => _116.hooks, 'optionalAccess', _117 => _117.onClose])
4811
+ } : _optionalChain([options, 'access', _120 => _120.hooks, 'optionalAccess', _121 => _121.onClose])
4795
4812
  },
4796
4813
  processorLock
4797
4814
  );
@@ -4848,7 +4865,7 @@ var postgreSQLEventStoreConsumer = (options) => {
4848
4865
  })
4849
4866
  );
4850
4867
  return result.some(
4851
- (r) => r.status === "fulfilled" && _optionalChain([r, 'access', _118 => _118.value, 'optionalAccess', _119 => _119.type]) !== "STOP"
4868
+ (r) => r.status === "fulfilled" && _optionalChain([r, 'access', _122 => _122.value, 'optionalAccess', _123 => _123.type]) !== "STOP"
4852
4869
  ) ? void 0 : {
4853
4870
  type: "STOP"
4854
4871
  };
@@ -4867,7 +4884,7 @@ var postgreSQLEventStoreConsumer = (options) => {
4867
4884
  if (!isRunning) return;
4868
4885
  isRunning = false;
4869
4886
  if (messagePuller) {
4870
- _optionalChain([abortController, 'optionalAccess', _120 => _120.abort, 'call', _121 => _121()]);
4887
+ _optionalChain([abortController, 'optionalAccess', _124 => _124.abort, 'call', _125 => _125()]);
4871
4888
  await messagePuller.stop();
4872
4889
  messagePuller = void 0;
4873
4890
  abortController = null;
@@ -4920,8 +4937,8 @@ var postgreSQLEventStoreConsumer = (options) => {
4920
4937
  stopWhen: options.stopWhen,
4921
4938
  executor: pool.execute,
4922
4939
  eachBatch,
4923
- batchSize: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _122 => _122.batchSize]), () => ( DefaultPostgreSQLEventStoreProcessorBatchSize)),
4924
- pullingFrequencyInMs: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _123 => _123.pullingFrequencyInMs]), () => ( DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs)),
4940
+ batchSize: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _126 => _126.batchSize]), () => ( DefaultPostgreSQLEventStoreProcessorBatchSize)),
4941
+ pullingFrequencyInMs: _nullishCoalesce(_optionalChain([pulling, 'optionalAccess', _127 => _127.pullingFrequencyInMs]), () => ( DefaultPostgreSQLEventStoreProcessorPullingFrequencyInMs)),
4925
4942
  signal: abortController.signal
4926
4943
  });
4927
4944
  start = (async () => {
@@ -4969,9 +4986,9 @@ var rebuildPostgreSQLProjections = (options) => {
4969
4986
  ...options,
4970
4987
  stopWhen: { noMessagesLeft: true }
4971
4988
  });
4989
+ const lock = { acquisitionPolicy: defaultRebuildLockPolicy, ...options.lock };
4972
4990
  const projections = "projections" in options ? options.projections.map(
4973
4991
  (p) => "projection" in p ? {
4974
- lockPolicy: defaultRebuildLockPolicy,
4975
4992
  truncateOnStart: true,
4976
4993
  processorId: getProjectorId({
4977
4994
  projectionName: _nullishCoalesce(p.projection.name, () => ( unknownTag2))
@@ -4982,14 +4999,14 @@ var rebuildPostgreSQLProjections = (options) => {
4982
4999
  processorId: getProjectorId({
4983
5000
  projectionName: _nullishCoalesce(p.name, () => ( unknownTag2))
4984
5001
  }),
4985
- truncateOnStart: true,
4986
- lockPolicy: defaultRebuildLockPolicy
5002
+ truncateOnStart: true
4987
5003
  }
4988
5004
  ) : [options];
4989
5005
  for (const projectionDefinition of projections) {
4990
5006
  consumer.projector({
4991
5007
  ...projectionDefinition,
4992
- truncateOnStart: _nullishCoalesce(projectionDefinition.truncateOnStart, () => ( true))
5008
+ truncateOnStart: _nullishCoalesce(projectionDefinition.truncateOnStart, () => ( true)),
5009
+ lock
4993
5010
  });
4994
5011
  }
4995
5012
  return consumer;