Himai Minh wrote:You may need to use a Json parser such as JSONParser to parse your original Json object and collect the data.
Then, use your data to create a new Json object.
Tim Moores wrote:There are freely available currency conversion WS out there. Either make your WS a proxy for one of them, or retrieve the rates you need to support in regular intervals (might once a day be sufficient? If not, maybe once per hour) and perform the conversion in your WS. I would advise the latter, as the former adds a network round-trip on top of the round-trip to your WS - not a good solution. (It would also raise the question: why use your WS if the client could simply use the other one instead?)
Tim Moores wrote:Just to make sure: the WS returns the exchange rate, and you want that WS to update its data in the background, independently from any client invocation?
What do you mean by "check the rate" - retrieving it from some other remote service?
Given that this is a single data point, I think using Redis would be overkill.
And I don't really see a pub/sub design, given that you're building a WS.
Dave Tolls wrote:With SQL you bind variables to values, not column names or chunks of SQL.
So that query won't work anyway.
Liutauras Vilda wrote:Hi Geane,
I find it confusing to understand the task. I have some ideas what you might want to do, but I have to admit that code looks confusing at the moment.
1. First, I think your chosen variables are misleading or not intuitive.
So this one the way I understand is, given the Status A, to which status it might go to from Status A, right? Not sure why you call it expectedStatus.
I'd call them along the lines: currentStatus -> nextStatus or transitionStatus, because having expectedStatus one may think, ok, it was given start Status A, but actually was expected Status B - see where the confusion may arise?
But what actually you have inside, is a list of States not Statuses.
2. In the other snippet of code you have
What this one supposed to achieve? As currently it does nothing in my understanding.
So if you ask me. I'd make those things clearer and delete parts of code which are not used, that way I'd find easier to understand where things fall apart, although lately I'm not that proficient in Kotlin.