napperley
06/26/2020, 7:06 AMamqp_basic_publish
function is returning 0 (this means the message has been successfully transmitted to the Broker). Below is the code that is being used to publish the message:
private fun publishMessage(conn: amqp_connection_state_t?) = memScoped {
val props = alloc<amqp_basic_properties_t>()
with(props) {
_flags = (AMQP_BASIC_CONTENT_TYPE_FLAG or AMQP_BASIC_DELIVERY_MODE_FLAG).toUInt()
// TODO: Figure out how to set the AMQP content type.
// content_type = amqp_cstring_bytes("text/plain")
// Persistent delivery mode.
delivery_mode = 2.toUByte()
}
println("Publishing message...")
val publishRc = amqp_basic_publish(
state = conn,
channel = channel,
exchange = amqp_cstring_bytes(EXCHANGE),
routing_key = amqp_cstring_bytes(ROUTING_KEY),
mandatory = 0,
immediate = 0,
properties = props.ptr,
body = amqp_cstring_bytes(MSG_BODY)
)
if (publishRc != 0) println("Cannot publish message.")
Unit
}
napperley
06/26/2020, 11:44 PMoperation basic.publish caused a channel exception not_found: no exchange 'ø' in vhost '/'
As I suspected there is something strange going on with the String handling.napperley
06/26/2020, 11:47 PMnapperley
06/26/2020, 11:49 PMnapperley
06/26/2020, 11:54 PM@kotlinx.cinterop.internal.CCall public external fun amqp_cstring_bytes(@kotlinx.cinterop.internal.CCall.CString cstr: kotlin.String?): kotlinx.cinterop.CValue<amqpClient.amqp_bytes_t /* = amqpClient.amqp_bytes_t_ */>