Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename folders #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DomainEventFailoverPublisher } from '../../../../Shared/infrastructure/EventBus/DomainEventFailoverPublisher/DomainEventFailoverPublisher';
import { RabbitMqConnection } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import { RabbitMQEventBus } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQEventBus';
import { RabbitMQqueueFormatter } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQqueueFormatter';
import { RabbitMQConfig } from './RabbitMQConfigFactory';

export class RabbitMQEventBusFactory {
static create(
failoverPublisher: DomainEventFailoverPublisher,
connection: RabbitMqConnection,
connection: RabbitMQConnection,
queueNameFormatter: RabbitMQqueueFormatter,
config: RabbitMQConfig
): RabbitMQEventBus {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DomainEventFailoverPublisher } from '../../../../Shared/infrastructure/EventBus/DomainEventFailoverPublisher/DomainEventFailoverPublisher';
import { RabbitMqConnection } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import { RabbitMQEventBus } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQEventBus';
import { RabbitMQqueueFormatter } from '../../../../Shared/infrastructure/EventBus/RabbitMQ/RabbitMQqueueFormatter';
import { RabbitMQConfig } from './RabbitMQConfigFactory';

export class RabbitMQEventBusFactory {
static create(
failoverPublisher: DomainEventFailoverPublisher,
connection: RabbitMqConnection,
connection: RabbitMQConnection,
queueNameFormatter: RabbitMQqueueFormatter,
config: RabbitMQConfig
): RabbitMQEventBus {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DomainEvent } from '../../../domain/DomainEvent';
import { DomainEventSubscriber } from '../../../domain/DomainEventSubscriber';
import { RabbitMqConnection } from './RabbitMqConnection';
import { RabbitMQConnection } from './RabbitMQConnection';
import { RabbitMQExchangeNameFormatter } from './RabbitMQExchangeNameFormatter';
import { RabbitMQqueueFormatter } from './RabbitMQqueueFormatter';

export class RabbitMQConfigurer {
constructor(
private connection: RabbitMqConnection,
private connection: RabbitMQConnection,
private queueNameFormatter: RabbitMQqueueFormatter,
private messageRetryTtl: number
) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import amqplib, { ConsumeMessage } from 'amqplib';
import { ConnectionSettings } from './ConnectionSettings';
import { RabbitMQExchangeNameFormatter } from './RabbitMQExchangeNameFormatter';

export class RabbitMqConnection {
export class RabbitMQConnection {
private connectionSettings: ConnectionSettings;
private channel?: amqplib.ConfirmChannel;
private connection?: amqplib.Connection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { ConsumeMessage } from 'amqplib';
import { DomainEvent } from '../../../domain/DomainEvent';
import { DomainEventSubscriber } from '../../../domain/DomainEventSubscriber';
import { DomainEventDeserializer } from '../DomainEventDeserializer';
import { RabbitMqConnection } from './RabbitMqConnection';
import { RabbitMQConnection } from './RabbitMQConnection';

export class RabbitMQConsumer {
private subscriber: DomainEventSubscriber<DomainEvent>;
private deserializer: DomainEventDeserializer;
private connection: RabbitMqConnection;
private connection: RabbitMQConnection;
private maxRetries: Number;
private queueName: string;
private exchange: string;

constructor(params: {
subscriber: DomainEventSubscriber<DomainEvent>;
deserializer: DomainEventDeserializer;
connection: RabbitMqConnection;
connection: RabbitMQConnection;
queueName: string;
exchange: string;
maxRetries: Number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DomainEvent } from '../../../domain/DomainEvent';
import { DomainEventSubscriber } from '../../../domain/DomainEventSubscriber';
import { DomainEventDeserializer } from '../DomainEventDeserializer';
import { RabbitMqConnection } from './RabbitMqConnection';
import { RabbitMQConnection } from './RabbitMQConnection';
import { RabbitMQConsumer } from './RabbitMQConsumer';

export class RabbitMQConsumerFactory {
constructor(
private deserializer: DomainEventDeserializer,
private connection: RabbitMqConnection,
private connection: RabbitMQConnection,
private maxRetries: Number
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import { DomainEventDeserializer } from '../DomainEventDeserializer';
import { DomainEventFailoverPublisher } from '../DomainEventFailoverPublisher/DomainEventFailoverPublisher';
import { DomainEventJsonSerializer } from '../DomainEventJsonSerializer';
import { DomainEventSubscribers } from '../DomainEventSubscribers';
import { RabbitMqConnection } from './RabbitMqConnection';
import { RabbitMQConnection } from './RabbitMQConnection';
import { RabbitMQConsumerFactory } from './RabbitMQConsumerFactory';
import { RabbitMQqueueFormatter } from './RabbitMQqueueFormatter';

export class RabbitMQEventBus implements EventBus {
private failoverPublisher: DomainEventFailoverPublisher;
private connection: RabbitMqConnection;
private connection: RabbitMQConnection;
private exchange: string;
private queueNameFormatter: RabbitMQqueueFormatter;
private maxRetries: Number;

constructor(params: {
failoverPublisher: DomainEventFailoverPublisher;
connection: RabbitMqConnection;
connection: RabbitMQConnection;
exchange: string;
queueNameFormatter: RabbitMQqueueFormatter;
maxRetries: Number;
Expand Down
10 changes: 5 additions & 5 deletions src/apps/backoffice/backend/BackofficeBackendApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EventBus } from '../../../Contexts/Shared/domain/EventBus';
import container from './dependency-injection';
import { DomainEventSubscribers } from '../../../Contexts/Shared/infrastructure/EventBus/DomainEventSubscribers';
import { Server } from './server';
import { RabbitMqConnection } from '../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';

export class BackofficeBackendApp {
server?: Server;
Expand All @@ -21,15 +21,15 @@ export class BackofficeBackendApp {
}

async stop() {
const rabbitMQConnection = container.get<RabbitMqConnection>('Backoffice.Shared.RabbitMQConnection');
await rabbitMQConnection.close();
const RabbitMQConnection = container.get<RabbitMQConnection>('Backoffice.Shared.RabbitMQConnection');
await RabbitMQConnection.close();
return this.server?.stop();
}

private async configureEventBus() {
const eventBus = container.get<EventBus>('Backoffice.Shared.domain.EventBus');
const rabbitMQConnection = container.get<RabbitMqConnection>('Backoffice.Shared.RabbitMQConnection');
await rabbitMQConnection.connect();
const RabbitMQConnection = container.get<RabbitMQConnection>('Backoffice.Shared.RabbitMQConnection');
await RabbitMQConnection.connect();

eventBus.addSubscribers(DomainEventSubscribers.from(container));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { RabbitMQConfig } from '../../../../Contexts/Backoffice/Courses/infrastructure/RabbitMQ/RabbitMQConfigFactory';
import { DomainEventSubscribers } from '../../../../Contexts/Shared/infrastructure/EventBus/DomainEventSubscribers';
import { RabbitMQConfigurer } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConfigurer';
import { RabbitMqConnection } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import { RabbitMQqueueFormatter } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQqueueFormatter';
import container from '../dependency-injection';

export class ConfigureRabbitMQCommand {
static async run() {
const connection = container.get<RabbitMqConnection>('Backoffice.Shared.RabbitMQConnection');
const connection = container.get<RabbitMQConnection>('Backoffice.Shared.RabbitMQConnection');
const nameFormatter = container.get<RabbitMQqueueFormatter>('Backoffice.Shared.RabbitMQQueueFormatter');
const { exchangeSettings, retryTtl } = container.get<RabbitMQConfig>('Backoffice.Shared.RabbitMQConfig');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
arguments: ['backoffice']

Backoffice.Shared.RabbitMQConnection:
class: ../../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection
class: ../../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection
arguments: ['@Backoffice.Shared.RabbitMQConfig']

Backoffice.Shared.RabbitMQqueueFormatter:
Expand Down
3 changes: 2 additions & 1 deletion src/apps/backoffice/backend/routes/courses.route.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Express } from 'express';
import container from '../dependency-injection';
import { CoursesPostController } from '../controllers/CoursesPostController';
import { CoursesGetController } from '../controllers/CoursesGetController';

export const register = (app: Express) => {
const coursesPostController: CoursesPostController = container.get(
'Apps.Backoffice.Backend.controllers.CoursesPostController'
);
const coursesGetController: CoursesPostController = container.get(
const coursesGetController: CoursesGetController = container.get(
'Apps.Backoffice.Backend.controllers.CoursesGetController'
);

Expand Down
10 changes: 5 additions & 5 deletions src/apps/mooc/backend/MoocBackendApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EventBus } from '../../../Contexts/Shared/domain/EventBus';
import container from './dependency-injection';
import { DomainEventSubscribers } from '../../../Contexts/Shared/infrastructure/EventBus/DomainEventSubscribers';
import { Server } from './server';
import { RabbitMqConnection } from '../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';

export class MoocBackendApp {
server?: Server;
Expand All @@ -21,15 +21,15 @@ export class MoocBackendApp {
}

async stop() {
const rabbitMQConnection = container.get<RabbitMqConnection>('Mooc.Shared.RabbitMQConnection');
await rabbitMQConnection.close();
const RabbitMQConnection = container.get<RabbitMQConnection>('Mooc.Shared.RabbitMQConnection');
await RabbitMQConnection.close();
return this.server?.stop();
}

private async configureEventBus() {
const eventBus = container.get<EventBus>('Mooc.Shared.domain.EventBus');
const rabbitMQConnection = container.get<RabbitMqConnection>('Mooc.Shared.RabbitMQConnection');
await rabbitMQConnection.connect();
const RabbitMQConnection = container.get<RabbitMQConnection>('Mooc.Shared.RabbitMQConnection');
await RabbitMQConnection.connect();

eventBus.addSubscribers(DomainEventSubscribers.from(container));
}
Expand Down
4 changes: 2 additions & 2 deletions src/apps/mooc/backend/command/ConfigureRabbitMQCommand.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { RabbitMQConfig } from '../../../../Contexts/Mooc/Shared/infrastructure/RabbitMQ/RabbitMQConfigFactory';
import { DomainEventSubscribers } from '../../../../Contexts/Shared/infrastructure/EventBus/DomainEventSubscribers';
import { RabbitMQConfigurer } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConfigurer';
import { RabbitMqConnection } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import container from '../dependency-injection';

export class ConfigureRabbitMQCommand {
static async run() {
const connection = container.get<RabbitMqConnection>('Mooc.Shared.RabbitMQConnection');
const connection = container.get<RabbitMQConnection>('Mooc.Shared.RabbitMQConnection');
const { name: exchange } = container.get<RabbitMQConfig>('Mooc.Shared.RabbitMQConfig').exchangeSettings;
await connection.connect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
arguments: ['mooc']

Mooc.Shared.RabbitMQConnection:
class: ../../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection
class: ../../../../../Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection
arguments: ['@Mooc.Shared.RabbitMQConfig']

Mooc.Shared.RabbitMQqueueFormatter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DomainEventDeserializer } from '../../../../../src/Contexts/Shared/infr
import { DomainEventFailoverPublisher } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/DomainEventFailoverPublisher/DomainEventFailoverPublisher';
import { DomainEventSubscribers } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/DomainEventSubscribers';
import { RabbitMQConfigurer } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConfigurer';
import { RabbitMqConnection } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import { RabbitMQConsumer } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConsumer';
import { RabbitMQEventBus } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQEventBus';
import { RabbitMQqueueFormatter } from '../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQqueueFormatter';
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('RabbitMQEventBus test', () => {
});

describe('integration', () => {
let connection: RabbitMqConnection;
let connection: RabbitMQConnection;
let dummySubscriber: DomainEventSubscriberDummy;
let configurer: RabbitMQConfigurer;
let failoverPublisher: DomainEventFailoverPublisher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RabbitMqConnection } from '../../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';

export class RabbitMQConnectionDouble extends RabbitMqConnection {
export class RabbitMQConnectionDouble extends RabbitMQConnection {

async publish(params: any): Promise<boolean> {
throw new Error();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { RabbitMqConnection } from '../../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMqConnection';
import { RabbitMQConnection } from '../../../../../../src/Contexts/Shared/infrastructure/EventBus/RabbitMQ/RabbitMQConnection';
import { RabbitMQConnectionDouble } from '../__mocks__/RabbitMQConnectionDouble';
import { RabbitMQConnectionConfigurationMother } from './RabbitMQConnectionConfigurationMother';

export class RabbitMQConnectionMother {
static async create() {
const config = RabbitMQConnectionConfigurationMother.create();
const connection = new RabbitMqConnection(config);
const connection = new RabbitMQConnection(config);
await connection.connect();
return connection;
}
Expand Down