Thank you for the reply. I did manage to create the function. But I want to execute the authentication method once in 1 hour when my scenario is executing say 5 hours. I dont want to kill my token server [which is shared with plenty of apps]. Can I execute the method authenticate only once. My method is like this…
Hi @ Diju_Elias, I am facing the same problem, Can you please elaborate a bit?
I wanted to make a post call, and i want to refresh token fro every 30 mins, Below is what i tried.
I tried to use pace - to call token method for every 30 mins like this , but pace doesn’t execute for every 30 mins, I was expecting pace to execute once as the method starts and execute next token method only after 30 mins, but it executes one after the other as the method starts.
private def Submit(noOfRuns: Int, bidSlots_feeder: BatchableFeederBuilder[String], round: String): ChainBuilder = {
pause(pauseBy(5) seconds)
.repeat(noOfRuns) {
pace(3600 seconds). —> want to run token method to set token in the session for every 30 mins.
.exec(AuthRequest.auth_token)
.feed(order_feeder)
.doIfEqualsOrElse(round, “1”) {
pause(pauseBy(10) seconds)
.exec(postToUri(s"${config.base}/orders/#{$AuctionId}/base-order/proxy-order", s"Submit orders for : #{$OrderId}")
.queryParam(“employeeId”, “#{empNo}”)
.body(StringBody(session => {
// body
}))
)
}
//postToUri uses the access token from the session for the post call.
Can you please advise the solutions you have implemented and how to use that to refresh the token?
Can you please advise where you are refreshing the token here ?