Skip to content

Commit 73d6dac

Browse files
authored
Distributed bus (#436)
1 parent 7e9e047 commit 73d6dac

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

packages/Ecotone/src/Modelling/Api/Distribution/DistributedServiceMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private function __construct(
3232
Assert::allObjects($this->distributedBusAnnotations, 'Annotations passed to DistributedServiceMap, must all be objects');
3333
}
3434

35-
public static function createEmpty(string $referenceName = DistributedBus::class): self
35+
public static function initialize(string $referenceName = DistributedBus::class): self
3636
{
3737
return new self($referenceName);
3838
}

packages/Ecotone/tests/Messaging/Unit/Distributed/DistributedBusWithServiceMapTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function test_distributing_command_to_another_service(): void
4949
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher'],
5050
[],
5151
$sharedQueueChannel,
52-
DistributedServiceMap::createEmpty()
52+
DistributedServiceMap::initialize()
5353
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
5454
);
5555
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Receiver'], [new TicketServiceReceiver()], $sharedQueueChannel);
@@ -86,7 +86,7 @@ public function test_distributing_command_to_another_service_with_conversion():
8686
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher', 'Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\CommandConverter'],
8787
[new RegisterTicketConverter()],
8888
$sharedQueueChannel,
89-
DistributedServiceMap::createEmpty()
89+
DistributedServiceMap::initialize()
9090
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
9191
);
9292
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Receiver', 'Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\CommandConverter'], [new TicketServiceReceiver(), new RegisterTicketConverter()], $sharedQueueChannel);
@@ -116,7 +116,7 @@ public function test_distributing_command_to_another_service_via_command_handler
116116
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher'],
117117
[new UserService()],
118118
$sharedQueueChannel,
119-
DistributedServiceMap::createEmpty()
119+
DistributedServiceMap::initialize()
120120
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
121121
);
122122
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Receiver'], [new TicketServiceReceiver()], $sharedQueueChannel);
@@ -138,7 +138,7 @@ public function test_failing_on_distribution_to_not_mapped_service(): void
138138
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher'],
139139
[],
140140
$sharedQueueChannel,
141-
DistributedServiceMap::createEmpty()
141+
DistributedServiceMap::initialize()
142142
);
143143

144144
$this->expectException(UnknownDistributedDestination::class);
@@ -163,7 +163,7 @@ public function test_failing_on_distribution_to_not_existing_message_channel_ser
163163
TestServiceName::USER_SERVICE,
164164
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher'],
165165
[new UserService()],
166-
extensionObjects: DistributedServiceMap::createEmpty()
166+
extensionObjects: DistributedServiceMap::initialize()
167167
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: 'not_existing_channel')
168168
);
169169
}
@@ -176,7 +176,7 @@ public function test_distributing_event_to_another_service(): void
176176
[],
177177
[],
178178
$sharedQueueChannel,
179-
DistributedServiceMap::createEmpty()
179+
DistributedServiceMap::initialize()
180180
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
181181
);
182182
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket'], [new \Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket\TicketServiceReceiver()], $sharedQueueChannel);
@@ -210,7 +210,7 @@ public function test_distributing_event_to_another_service_with_conversion(): vo
210210
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicketWithConversion'],
211211
[new UserChangedAddressConverter()],
212212
$sharedQueueChannel,
213-
DistributedServiceMap::createEmpty()
213+
DistributedServiceMap::initialize()
214214
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
215215
);
216216
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicketWithConversion'], [new \Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicketWithConversion\TicketServiceReceiver(), new UserChangedAddressConverter()], $sharedQueueChannel);
@@ -240,7 +240,7 @@ public function test_distributing_event_to_all_services_within_map(): void
240240
[],
241241
[],
242242
[$distributedTicketQueue, $distributedOrderQueue],
243-
DistributedServiceMap::createEmpty()
243+
DistributedServiceMap::initialize()
244244
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName)
245245
->withServiceMapping(serviceName: TestServiceName::ORDER_SERVICE, channelName: $orderChannelName)
246246
);
@@ -276,7 +276,7 @@ public function test_it_does_not_publish_event_to_publishing_service_when_in_ser
276276
[],
277277
[],
278278
[$distributedTicketQueue, $distributedUserQueue],
279-
DistributedServiceMap::createEmpty()
279+
DistributedServiceMap::initialize()
280280
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName)
281281
->withServiceMapping(serviceName: TestServiceName::USER_SERVICE, channelName: $userChannelName)
282282
);
@@ -301,7 +301,7 @@ public function test_publishing_events_with_name_filtering(): void
301301
[],
302302
[],
303303
[$distributedTicketQueue, $distributedOrderQueue],
304-
DistributedServiceMap::createEmpty()
304+
DistributedServiceMap::initialize()
305305
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName, subscriptionRoutingKeys: ['userService.*'])
306306
->withServiceMapping(serviceName: TestServiceName::ORDER_SERVICE, channelName: $orderChannelName, subscriptionRoutingKeys: ['ticketService.*'])
307307
);
@@ -326,7 +326,7 @@ public function test_if_two_keys_match_event_is_published_once(): void
326326
[],
327327
[],
328328
[$distributedTicketQueue],
329-
DistributedServiceMap::createEmpty()
329+
DistributedServiceMap::initialize()
330330
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName, subscriptionRoutingKeys: ['userService.*', '*'])
331331
);
332332
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket'], [new \Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket\TicketServiceReceiver()], $distributedTicketQueue);
@@ -349,7 +349,7 @@ public function test_not_receiving_for_empty_array(): void
349349
[],
350350
[],
351351
[$distributedTicketQueue],
352-
DistributedServiceMap::createEmpty()
352+
DistributedServiceMap::initialize()
353353
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName, subscriptionRoutingKeys: [])
354354
);
355355
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket'], [new \Test\Ecotone\Messaging\Fixture\Distributed\DistributedEventBus\ReceiverTicket\TicketServiceReceiver()], $distributedTicketQueue);
@@ -375,7 +375,7 @@ public function test_sending_to_distributed_bus_with_middleware_channel(): void
375375
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher'],
376376
[],
377377
[$sharedQueueChannel, $outboxChannel],
378-
DistributedServiceMap::createEmpty()
378+
DistributedServiceMap::initialize()
379379
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
380380
->withAsynchronousChannel('outbox')
381381
);
@@ -424,9 +424,9 @@ public function test_registering_more_than_one_service_map(): void
424424
[],
425425
[$distributedTicketQueue, $distributedOrderQueue],
426426
[
427-
DistributedServiceMap::createEmpty(referenceName: $internalDistributedBus = DistributedBus::class . '-internal')
427+
DistributedServiceMap::initialize(referenceName: $internalDistributedBus = DistributedBus::class . '-internal')
428428
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $ticketChannelName),
429-
DistributedServiceMap::createEmpty(referenceName: $externalDistributedBus = DistributedBus::class . '-external')
429+
DistributedServiceMap::initialize(referenceName: $externalDistributedBus = DistributedBus::class . '-external')
430430
->withServiceMapping(serviceName: TestServiceName::ORDER_SERVICE, channelName: $orderChannelName),
431431
],
432432
);
@@ -480,7 +480,7 @@ public function test_combining_distributed_bus_with_dynamic_message_channels():
480480
[],
481481
[$dynamicMessageChannel],
482482
[
483-
DistributedServiceMap::createEmpty()
483+
DistributedServiceMap::initialize()
484484
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $dynamicMessageChannel->getMessageChannelName()),
485485
],
486486
);
@@ -553,7 +553,7 @@ public function test_throws_exception_without_enterprise_licence(): void
553553
configuration: ServiceConfiguration::createWithDefaults()
554554
->withServiceName('test')
555555
->withExtensionObjects([
556-
DistributedServiceMap::createEmpty(),
556+
DistributedServiceMap::initialize(),
557557
]),
558558
pathToRootCatalog: __DIR__ . '/../../',
559559
);
@@ -566,7 +566,7 @@ public function test_it_throws_exception_when_no_service_name_is_given(): void
566566
EcotoneLite::bootstrapFlowTesting(
567567
configuration: ServiceConfiguration::createWithDefaults()
568568
->withExtensionObjects([
569-
DistributedServiceMap::createEmpty(),
569+
DistributedServiceMap::initialize(),
570570
]),
571571
pathToRootCatalog: __DIR__ . '/../../',
572572
licenceKey: LicenceTesting::VALID_LICENCE,
@@ -581,7 +581,7 @@ public function test_intercepting_sending_messages(): void
581581
['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Publisher', 'Test\Ecotone\Messaging\Fixture\Distributed\DistributedSendInterceptor'],
582582
[new DistributedSendInterceptor()],
583583
$sharedQueueChannel,
584-
DistributedServiceMap::createEmpty()
584+
DistributedServiceMap::initialize()
585585
->withServiceMapping(serviceName: TestServiceName::TICKET_SERVICE, channelName: $channelName)
586586
);
587587
$ticketService = $this->bootstrapEcotone(TestServiceName::TICKET_SERVICE, ['Test\Ecotone\Messaging\Fixture\Distributed\DistributedCommandBus\Receiver'], [new TicketServiceReceiver()], $sharedQueueChannel);

packages/Kafka/src/Configuration/KafkaPublisherConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class KafkaPublisherConfiguration implements DefinedObject
2323
/**
2424
* @param array<string, string> $configuration
2525
*/
26-
private function __construct(
26+
public function __construct(
2727
private string $defaultTopicName,
2828
private string $referenceName,
2929
private array $configuration,

0 commit comments

Comments
 (0)