-
Notifications
You must be signed in to change notification settings - Fork 0
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
PACT-709: First implementation of stub #1
base: main
Are you sure you want to change the base?
Conversation
bf995c4
to
92743cf
Compare
I'm having a bit of trouble getting this to run, following the README. Bringing up the containers is fine:
However:
Am I missing a step? |
@tna-erasmos until such a time as these two PRs fp-in-bo/jms4s#363 & fp-in-bo/jms4s#359 have been merged we will have to maintain a hybrid version which has both which I have created here . You will need to check out this |
@rwalpole, how about we put those instructions in the README, temporarily? |
@tna-erasmos, sure, updated README. |
Some progress. I built this branch of
However, It was due to
I changed this to:
And it worked.
And from the Elastic MQ console at http://localhost:9325/, I can see that there are two queues: I'm guessing that the other queue is for responses. Now I just need to figure out how to take it for a spin. |
I sorted it; see my QA here. I'll start to review the code, itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving, as-is.
Though I'd recommend adding more instructions.
# JMS4s Request-Reply Stub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add some instructions for demonstrating this, using the restful API?
See this comment.
private implicit val logger: SelfAwareStructuredLogger[IO] = logging.getLogger | ||
private val clientId = "echo_server_1" | ||
private val requestQueue = QueueName("request-general") | ||
private val replyQueue = QueueName("omega-editorial-web-application-instance-1") //TODO(AR) note this is for the editorial web application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's clear enough without the comment?
private val jmsClient: Resource[IO, JmsClient[IO]] = simpleQueueService.makeJmsClient[IO]( | ||
Config( | ||
endpoint = Endpoint(Some(DirectAddress(HTTP, "localhost", Some(9324))),"elasticmq"), | ||
credentials = Some(Credentials("x","x")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these creds be anything?
consumer <- client.createAcknowledgerConsumer(requestQueue, concurrencyLevel = consumerConcurrencyLevel, pollingInterval = 50.millis) | ||
} yield consumer | ||
|
||
consumerRes.use(_.handle { (jmsMessage, mf) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps rename mf
to messageFactory
?
_ <- IO.println(s"Echo Server received message: $requestText") | ||
responseText <- IO.pure(s"Echo Server: $requestText") | ||
responseMessage <- mf.makeTextMessage(responseText) | ||
// PERFORM THE ACTUAL SERVICE HERE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this note still needed (ACTUAL SERVICE
)?
responseText <- IO.pure(s"Echo Server: $requestText") | ||
responseMessage <- mf.makeTextMessage(responseText) | ||
// PERFORM THE ACTUAL SERVICE HERE | ||
// NOTE(AR) set correlationId on response message to the request message id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's clear enough without the comment?
|
||
queues { | ||
request-general { } | ||
omega-editorial-web-application-instance-1 { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why instance-1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, the lib version should be updated.
override def run(args: List[String]): IO[ExitCode] = { | ||
|
||
val consumerRes = for { | ||
_ <- Resource.liftK(IO.println("Starting EchoServer...")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure how cats effects IO class works, but do we want to use the logger here instead of println?
import sbt._ | ||
|
||
object Dependencies { | ||
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is file used at all?
Also, are we going to be using scalatest or Munit?
Now I'm wondering if we need this stub service at all. I had expected that this would have been integrated into I'll bring it up at standup. |
@rwalpole has explained that two attempts were already made to integrate the stub inside |
No description provided.