Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For a more in-depth look at RabbitMQ they provide a few nice tutorials: https://www.rabbitmq.com/getstarted.html

Within duo-message-broker there are 3 queues and 1 exchange defined:messageBroker.ts we define a default exchange

Code Block
 export   Queue["PROPOSAL"]const EXCHANGE_NAME =
"PROPOSAL";     Queue["SCHEDULING_PROPOSAL"] = "SCHEDULING_PROPOSAL";
    Queue["SCHEDULED_EVENTS"] = "SCHEDULED_EVENTS";
    Queue["BROADCAST"] = "useroffice.fanout"; // The exchange

...

 process.env.CORE_EXCHANGE_NAME || 'user_office_backend.fanout';

But this can be overwritten if needed:

Code Block
        await rabbitMQ.sendMessageToExchange(
          event.exchange || EXCHANGE_NAME,
          event.type,
          jsonMessage
        );

We have a general type ProposalMessageData which is sent over most events:

Code Block
type  const messageData: ProposalMessageData = {
     proposalPk: number;
  proposal.primaryKey,
    shortCode: string;
 proposal.proposalId,
    instrument: instrument,
    title: string;
  proposal.title,
    abstract: string;
 proposal.abstract,
    callId: call.id,
    allocatedTime: proposalAllocatedTime,
    instrumentId: instrument?.id,
    members: proposalUsersWithInstitution.map(
      (proposalUserWithInstitution) => ({
        firstName: string;proposalUserWithInstitution.user.firstname,
        lastName: string; proposalUserWithInstitution.user.lastname,
        email: string;proposalUserWithInstitution.user.email,
        id: string }[];
  proposer?: { firstName: string; lastName: string; email: string; id: string };
};

The data sent over the message queue:

...

Event

...

Queue

...

Data

...

PROPOSAL_STATUS_CHANGED_BY_WORKFLOW

...

PROPOSAL, SCHEDULING_PROPOSAL

...

proposalPk, callId, allocatedTime, instrumentId

...

PROPOSAL_STATUS_CHANGED_BY_USER

...

PROPOSAL, SCHEDULING_PROPOSAL

...

proposalPk, callId, allocatedTime, instrumentId

...

PROPOSAL_MANAGEMENT_DECISION_SUBMITTED

...

useroffice.fanout

...

ProposalMessageData

...

PROPOSAL_UPDATED

...

useroffice.fanout

...

ProposalMessageData

...

PROPOSAL_DELETED

...

SCHEDULING_PROPOSAL

...

ProposalMessageData

...

PROPOSAL_CREATED

...

useroffice.fanout

...

ProposalMessageData

...

PROPOSAL_SUBMITTED

...

useroffice.fanout

...

ProposalMessageData

...

TOPIC_ANSWERED

...

useroffice.fanout

...

proposalId, question, questionId, dataType, answer

...

CALL_CREATED

...

useroffice.fanout

...

All the call data

Currently the system is only listening on 1 queue SCHEDULED_EVENTS and on events:

...

PROPOSAL_BOOKING_TIME_SLOT_ADDED

...

PROPOSAL_BOOKING_TIME_SLOTS_REMOVED

...

PROPOSAL_BOOKING_TIME_ACTIVATED

...

PROPOSAL_BOOKING_TIME_COMPLETED

...

PROPOSAL_BOOKING_TIME_UPDATED

...

 proposalUserWithInstitution.user.id.toString(),
        oidcSub: proposalUserWithInstitution.user.oidcSub,
        oauthIssuer: proposalUserWithInstitution.user.oauthIssuer,
        institution: proposalUserWithInstitution.institution,
        country: proposalUserWithInstitution.country,
      })
    ),
    newStatus: proposalStatus?.shortCode,
    submitted: proposal.submitted,
  };

For details of specific events and what data they are sending please look at the message broker itself:

https://github.com/UserOfficeProject/user-office-core/blob/30b5dc11b105cc863394456f246706c046dc7705/apps/backend/src/eventHandlers/messageBroker.ts#L208C1-L208C1

The list of events being sent as of 30/11/2023

Code Block
Event.PROPOSAL_CREATED
Event.PROPOSAL_UPDATED
Event.PROPOSAL_SUBMITTED
Event.PROPOSAL_DELETED
Event.PROPOSAL_STATUS_ACTION_EXECUTED:
Event.INSTRUMENT_CREATED
Event.INSTRUMENT_UPDATED
Event.INSTRUMENT_DELETED
Event.TOPIC_ANSWERED
Event.CALL_CREATED
Event.USER_UPDATED
Event.USER_DELETED

Proposal Allocations

The STFC have the proposal allocations app to integrate the proposal system with our other systems currently. It is currently listening to the userofficeuser_office_backend.fanout exchange for the following events:

  • PROPOSAL_UPDATED

  • PROPOSAL_SUBMITTED

  • CALL_CREATED

  • PROPOSAL_STATUS_CHANGED_BY_USER

  • TOPIC_ANSWERED

STFC RabbitMQ Config

We have set up a user account and vhost for our applications to use, this has can be set up through the web interface.

The vhost name is proposals with default config. The user account is proposal-submission-user and password should be set the one stored in rabbitmq-user-pass in BisAppSettings