Skip to content

Commit

Permalink
Merge pull request #264 from dolittle:eh-logging
Browse files Browse the repository at this point in the history
Adding logging for event horizon setup
  • Loading branch information
einari authored Aug 23, 2021
2 parents 3cb637f + c6b219a commit 2b78ab0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Source/typescript/backend/dolittle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,31 @@ export async function initialize(configuration: Configuration, startArguments: B
const eventHorizons = EventHorizons.load();
for (const tenant of eventHorizons.keys()) {
_.forTenant(tenant, sb => {
logger.info(`Configure EventHorizon for ${tenant}`);
for (const subscription of eventHorizons.get(tenant)!) {

logger.info(' Subscription:');
logger.info(` Microservice: ${subscription.microservice}`);
logger.info(` Producer Tenant: ${subscription.tenant}`);
logger.info(` Producer Stream: ${subscription.stream}`);
logger.info(` Partition: ${subscription.partition}`);
logger.info(` To Scope: ${subscription.scope}`);

sb
.fromProducerMicroservice(subscription.microservice)
.fromProducerTenant(subscription.tenant)
.fromProducerStream(subscription.stream)
.fromProducerPartition(subscription.partition)
.toScope(subscription.scope);
.toScope(subscription.scope)
.onSuccess((tenant, subscription, _) => logger.info(`Subscription '${subscription}' for '${tenant}' connected successfully`))
.onFailure((tenant, subscription, response) => logger.error(`Subscription '${subscription}' for '${tenant}' failed with '${response.failure?.reason}'`));
}
});
}
})
.withFilters(_ => {
if (startArguments.publishAllPublicEvents !== false) {
logger.info(`Setting up default public filter to publish all public events to stream with Id: '${configuration.microserviceId}'`);
_.createPublicFilter(configuration.microserviceId, fb => fb
.handle((event, context) => {
return new PartitionedFilterResult(true, PartitionId.unspecified);
Expand Down

0 comments on commit 2b78ab0

Please sign in to comment.