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

add boolean flag for AMQPS #131

Merged
merged 2 commits into from
Oct 26, 2023
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
10 changes: 9 additions & 1 deletion src/SimulationService.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const RABBITMQ_PASSWORD = Ref{String}()
const RABBITMQ_ROUTE = Ref{String}()
const RABBITMQ_HOST = Ref{String}()
const RABBITMQ_PORT = Ref{Int}()
const RABBITMQ_SSL = Ref{Bool}()

function __init__()
if Threads.nthreads() == 1
Expand All @@ -78,12 +79,19 @@ function __init__()
RABBITMQ_ROUTE[] = get(ENV, "SIMSERVICE_RABBITMQ_ROUTE", "sciml-queue")
RABBITMQ_HOST[] = get(ENV, "SIMSERVICE_RABBITMQ_HOST", "localhost")
RABBITMQ_PORT[] = parse(Int, get(ENV, "SIMSERVICE_RABBITMQ_PORT", "5672"))
RABBITMQ_SSL[] = get(ENV, "SIMSERVICE_RABBITMQ_SSL", "false") == "true"

if RABBITMQ_ENABLED[]
auth_params = Dict{String,Any}(
("MECHANISM" => "AMQPLAIN", "LOGIN" => RABBITMQ_LOGIN[], "PASSWORD" => RABBITMQ_PASSWORD[])
)
conn = AMQPClient.connection(; virtualhost="/", host=RABBITMQ_HOST[], port=RABBITMQ_PORT[], auth_params)

amqps = nothing
if RABBITMQ_SSL[]
amqps = AMQPClient.amqps_configure()
end

conn = AMQPClient.connection(; virtualhost="/", host=RABBITMQ_HOST[], port=RABBITMQ_PORT[], auth_params, amqps)

rabbitmq_channel[] = AMQPClient.channel(conn, AMQPClient.UNUSED_CHANNEL, true)
AMQPClient.queue_declare(rabbitmq_channel[], RABBITMQ_ROUTE[]; durable=true)
Expand Down
Loading