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

feat!: add ws client to pull updated configuration #147

Merged
merged 22 commits into from
Jun 16, 2022

Conversation

kleyow
Copy link
Collaborator

@kleyow kleyow commented Jun 3, 2022

  • Ported over websocket client code from sdk-scheme-adapter
  • Added feature to query websocket server for configuration on startup
  • Added feature that will restart inbound/outbound servers on websocket configuration change message
  • Conform config to camelcase/sdk-scheme-adapter since the client has merging config logic that depends on keys being the same
  • Add parent server class that runs all servers/clients akin to sdk-scheme-adapter

@kleyow kleyow marked this pull request as ready for review June 10, 2022 10:15
Copy link
Member

@mdebarros mdebarros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kleyow,

I don't see any major with the PR, just see my one comment about breaking changes with regard to the CASE change in the config, and also if any new additional configs required for this change would also be breaking?

I also recommend some updates to documentation...I.e. perhaps add something explaining (and/or linking) these changes for PM4ML support.

"mgmtAPIWsUrl": "127.0.0.1",
"mgmtAPIWsPort": 4010
},
"inbound": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would UPPER-CASE to CAME-CASE be a breaking change here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure. So...I'm going to make it one.

@kleyow kleyow changed the title feat: add ws client to pull updated configuration feat!: add ws client to pull updated configuration Jun 14, 2022
@kleyow
Copy link
Collaborator Author

kleyow commented Jun 14, 2022

I also recommend some updates to documentation...I.e. perhaps add something explaining (and/or linking) these changes for PM4ML support.

I'll ask someone for the relevant documentation if there is any and add it to the readme.

Comment on lines 38 to 39
"release": "standard-version --releaseCommitMessageFormat 'chore(release): {{currentTag}} [skip ci]'",
"snapshot": "standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard-version marked as deprecated:
https://www.npmjs.com/package/standard-version

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with a fork that seems to have active contributions for now.

switch (msg.msg) {
case MESSAGE.CONFIGURATION:
switch (msg.verb) {
case VERB.NOTIFY:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to pull the latest changes from mojaloop-connector:
infitx-org/mojaloop-connector@da5384d...master

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Comment on lines +34 to +50
let serverInstance: Server | null

export async function start(server: Server): Promise<Server> {
await server.start()
const serverApp = server.settings.app as ServerApp
logger.info(`Service '${PACKAGE.name}' is running '${serverApp.api} API' @ ${server.info.uri}`)
serverInstance = server
return server
}

export async function stop(server: Server): Promise<Server> {
await server.stop()
serverInstance = null
return server
}

export async function restart(server: Server): Promise<void | Server> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be cleaner to have a factory class rather than separate methods in a module.
So instead of

import someModule from './server';
someModule.start(); // <--- it's unclear which module we access

we can have:

import { Server } from './server';
const server = Server::start(); // it's clear that we access Server class

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather just keep it functional for now vs extending off of hapi.server. I found it not that inituitive as well when messing about but lets leave that for a future refactor

@kleyow kleyow merged commit 6e2e2a8 into mojaloop:master Jun 16, 2022
@kleyow kleyow deleted the feat/control-agent branch June 16, 2022 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants