@@ -15,6 +15,7 @@ class AmqpWebhookHandler : WebhookHandler {
1515 private lateinit var connection: Connection
1616 private lateinit var exchange: String
1717 private lateinit var connectionFactory: ConnectionFactory
18+ private var deliveryMode: Int = 1
1819
1920 companion object {
2021 const val PROVIDER_ID = " webhook-amqp"
@@ -25,23 +26,23 @@ class AmqpWebhookHandler : WebhookHandler {
2526 @JvmStatic
2627 private val logger = LoggerFactory .getLogger(AmqpWebhookHandler ::class .java)
2728
28- @JvmStatic
29- private fun getMessageProps (className : String ): BasicProperties {
30- val headers: MutableMap <String , Any > = HashMap ()
31- headers[" __TypeId__" ] = className
32- return BasicProperties .Builder ()
33- .appId(" Keycloak/Kotlin" )
34- .headers(headers)
35- .contentType(MediaType .APPLICATION_JSON )
36- .contentEncoding(" UTF-8" )
37- .build()
38- }
39-
4029 @JvmStatic
4130 private fun genRoutingKey (request : WebhookPayload ): String =
4231 " KC_CLIENT.${request.realmId} .${request.clientId ? : " xxx" } .${request.userId ? : " xxx" } .${request.type} "
4332 }
4433
34+ private fun getMessageProps (className : String ): BasicProperties {
35+ val headers: MutableMap <String , Any > = HashMap ()
36+ headers[" __TypeId__" ] = className
37+ return BasicProperties .Builder ()
38+ .appId(" Keycloak/Kotlin" )
39+ .headers(headers)
40+ .contentType(MediaType .APPLICATION_JSON )
41+ .contentEncoding(" UTF-8" )
42+ .deliveryMode(this .deliveryMode)
43+ .build()
44+ }
45+
4546 /* *
4647 * Ensures that the connection and channel are open.
4748 * If either is closed, it will try to reinitialize them up to 3 times.
@@ -122,6 +123,7 @@ class AmqpWebhookHandler : WebhookHandler {
122123 val amqp = AmqpConfig .fromEnv()
123124
124125 exchange = amqp.exchange
126+ deliveryMode = amqp.deliveryMode
125127
126128 if (this ::connection.isInitialized && this ::channel.isInitialized && connection.isOpen && channel.isOpen) {
127129 logger.debug(" Connection is already open" )
0 commit comments