Skip to content

Commit

Permalink
Merge pull request #2456 from hongwei1/develop
Browse files Browse the repository at this point in the history
refactor/separate the RabbitMq setting
  • Loading branch information
simonredfern authored Dec 3, 2024
2 parents 7bcb6bc + 8a1b5f1 commit 092f906
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ object RabbitMQUtils extends MdcLoggable{
val truststorePath = APIUtil.getPropsValue("truststore.path").getOrElse("")
val truststorePassword = APIUtil.getPropsValue("keystore.password").getOrElse(APIUtil.initPasswd)

val args = new util.HashMap[String, AnyRef]()
val rpcQueueArgs = new util.HashMap[String, AnyRef]()
rpcQueueArgs.put("x-message-ttl", Integer.valueOf(60000))

val rpcReplyToQueueArgs = new util.HashMap[String, AnyRef]()
//60s It sets the time (in milliseconds) after which the queue will
// automatically be deleted if it is not used, i.e., if no consumer is connected to it during that time.
args.put("x-expires", Integer.valueOf(60000))
args.put("x-message-ttl", Integer.valueOf(60000))
//args.put("x-queue-type", "quorum") // use the classic first.
rpcReplyToQueueArgs.put("x-expires", Integer.valueOf(60000))
rpcReplyToQueueArgs.put("x-message-ttl", Integer.valueOf(60000))


private implicit val formats = code.api.util.CustomJsonFormats.nullTolerateFormats
Expand Down Expand Up @@ -90,15 +92,15 @@ object RabbitMQUtils extends MdcLoggable{
true, // durable: non-persis, here set durable = true
false, // exclusive: non-excl4, here set exclusive = false
false, // autoDelete: delete, here set autoDelete = false
args // extra arguments,
rpcQueueArgs // extra arguments,
)

val replyQueueName:String = channel.queueDeclare(
s"${RPC_REPLY_TO_QUEUE_NAME_PREFIX}_${messageId.replace("obp_","")}_${UUID.randomUUID.toString}", // Queue name, it will be a unique name for each queue
false, // durable: non-persis, here set durable = false
true, // exclusive: non-excl4, here set exclusive = true
true, // autoDelete: delete, here set autoDelete = true
args // extra arguments,
rpcReplyToQueueArgs // extra arguments,
).getQueue

val rabbitResponseJsonFuture = {
Expand Down
5 changes: 5 additions & 0 deletions obp-api/src/main/scala/code/consent/ConsentProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ trait ConsentTrait {
* Specified end date and time for the transaction query period. If the field does not contain information or if it is not sent in the request, the end date will be 90 calendar days prior to the creation of the consent.
*/
def transactionToDateTime: Date

/**
* this will be a UUID later. now only use the primacyKey.toString for it.
*/
def consentReferenceId: String
}

object ConsentStatus extends Enumeration {
Expand Down
1 change: 1 addition & 0 deletions obp-api/src/main/scala/code/consent/MappedConsent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class MappedConsent extends ConsentTrait with LongKeyedMapper[MappedConsent] wit
override def transactionToDateTime= mTransactionToDateTime.get
override def creationDateTime= createdAt.get
override def statusUpdateDateTime= mStatusUpdateDateTime.get
override def consentReferenceId = id.get.toString

}

Expand Down

0 comments on commit 092f906

Please sign in to comment.