Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: allow LongString in the x-rpc-path header #9596

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions core/src/main/java/fr/sncf/osrd/cli/WorkerCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ package fr.sncf.osrd.cli

import com.beust.jcommander.Parameter
import com.beust.jcommander.Parameters
import com.rabbitmq.client.AMQP
import com.rabbitmq.client.Channel
import com.rabbitmq.client.ConnectionFactory
import com.rabbitmq.client.DeliverCallback
import com.rabbitmq.client.*
import fr.sncf.osrd.api.*
import fr.sncf.osrd.api.api_v2.conflicts.ConflictDetectionEndpointV2
import fr.sncf.osrd.api.api_v2.path_properties.PathPropEndpoint
Expand Down Expand Up @@ -154,7 +151,11 @@ class WorkerCommand : CliCommand {
val correlationId = message.properties.correlationId
val body = message.body
val path =
(message.properties.headers["x-rpc-path"] as ByteArray?)?.decodeToString()
if (message.properties.headers["x-rpc-path"] is LongString) {
message.properties.headers["x-rpc-path"].toString()
} else {
(message.properties.headers["x-rpc-path"] as? ByteArray?)?.decodeToString()
}
if (path == null) {
logger.error("missing x-rpc-path header")
channel.basicReject(message.envelope.deliveryTag, false)
Expand Down
Loading