Skip to content

Commit cf957b9

Browse files
dgafkagitbook-bot
authored andcommitted
GITBOOK-888: No subject
1 parent 6ad06aa commit cf957b9

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

modelling/microservices-php/distributed-bus/distributed-bus-with-service-map/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Making Service available for integration is matter of adding it to the Service M
2626
#[ServiceContext]
2727
public function serviceMap(): DistributedServiceMap
2828
{
29-
return DistributedServiceMap::createEmpty()
29+
return DistributedServiceMap::initialize()
3030
->withServiceMapping(
3131
serviceName: "ticketService",
3232
channelName: "distributed_ticket_service"
@@ -98,7 +98,7 @@ In User Service let's then define Service Map using [ServiceContext](../../../..
9898
#[ServiceContext]
9999
public function serviceMap(): DistributedServiceMap
100100
{
101-
return DistributedServiceMap::createEmpty()
101+
return DistributedServiceMap::initialize()
102102
->withServiceMapping(
103103
serviceName: "ticketService",
104104
channelName: "distributed_ticket_service"
@@ -182,7 +182,7 @@ To configure map with subscription keys, we will be using **subscriptionRoutingK
182182
#[ServiceContext]
183183
public function serviceMap(): DistributedServiceMap
184184
{
185-
return DistributedServiceMap::createEmpty()
185+
return DistributedServiceMap::initialize()
186186
->withServiceMapping(
187187
serviceName: "ticketService",
188188
channelName: "distributed_ticket_service",

modelling/microservices-php/distributed-bus/distributed-bus-with-service-map/configuration.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,31 @@ In order for `Ecotone` how to route messages you need to register Service Name (
88
* [Laravel Service Name Configuration](../../../../modules/laravel/laravel-ddd-cqrs-event-sourcing.md#servicename)
99
* [Ecotone Lite Service Name Configuration](../../../../modules/ecotone-lite/#servicename) 
1010

11-
## Register Service Map
11+
## Register Service Map for Consumption
12+
13+
The minimum needed for enabling Distributed Bus with Service Map and start consuming is to tell Ecotone, that we do use Service Map within the Service
14+
15+
```php
16+
#[ServiceContext]
17+
public function serviceMap(): DistributedServiceMap
18+
{
19+
return DistributedServiceMap::initialize()
20+
->withServiceMapping(
21+
serviceName: "ticketService",
22+
channelName: "distributed_ticket_service"
23+
)
24+
}
25+
```
26+
27+
## Register Service Map for Publishing
1228

1329
Register Distributed Bus with given Service Map:
1430

1531
```php
1632
#[ServiceContext]
1733
public function serviceMap(): DistributedServiceMap
1834
{
19-
return DistributedServiceMap::createEmpty()
35+
return DistributedServiceMap::initialize()
2036
->withServiceMapping(
2137
serviceName: "ticketService",
2238
channelName: "distributed_ticket_service"
@@ -28,7 +44,7 @@ and define implementation of the distributed Message Channel:
2844

2945
```php
3046
#[ServiceContext]
31-
public function serviceMap(): DistributedServiceMap
47+
public function channels()
3248
{
3349
return SqsBackedMessageChannelBuilder::create("distributed_ticket_service")
3450
}

modelling/microservices-php/distributed-bus/distributed-bus-with-service-map/custom-features.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To configure this up, we need to have our [Database Message Channel](../../../as
1212
#[ServiceContext]
1313
public function serviceMap(): DistributedServiceMap
1414
{
15-
return DistributedServiceMap::createEmpty()
15+
return DistributedServiceMap::initialize()
1616
->withServiceMapping(serviceName: "ticketService", channelName: "distributed_ticket_service")
1717
->withAsynchronousChannel('database_channel')
1818
}
@@ -29,9 +29,9 @@ In case we would like to explicitly separate Service Maps for specific integrati
2929
public function serviceMap(): DistributedServiceMap
3030
{
3131
return [
32-
DistributedServiceMap::createEmpty(referenceName: 'internalDistributedBus')
32+
DistributedServiceMap::initialize(referenceName: 'internalDistributedBus')
3333
->withServiceMapping(serviceName: "ticketService", channelName: "distributed_ticket_service"),
34-
DistributedServiceMap::createEmpty(referenceName: 'externalDistributedBus')
34+
DistributedServiceMap::initialize(referenceName: 'externalDistributedBus')
3535
->withServiceMapping(serviceName: "orderService", channelName: "distributed_order_service")
3636
];
3737
}

modelling/microservices-php/distributed-bus/distributed-bus-with-service-map/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $userService = EcotoneLite::bootstrapFlowTesting(
1818
->withServiceName('user_service')
1919
->withExtensionObjects([
2020
// distributed service map on the publisher side
21-
DistributedServiceMap::createEmpty()
21+
DistributedServiceMap::initialize()
2222
->withServiceMapping(serviceName: 'ticket_service', channelName: 'distributed_ticket'),
2323
// shared in memory channel
2424
enableAsynchronousProcessing: [distributedTicketChannel]

0 commit comments

Comments
 (0)