Skip to content

Commit

Permalink
send client_information to amqp-client
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Apr 4, 2024
1 parent 3bd5413 commit 41ec0b4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/lavinmq/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module LavinMQ
property log_file : String? = nil
property log_level : Log::Severity = DEFAULT_LOG_LEVEL
property amqp_bind = "127.0.0.1"
property amqp_port = 5672
property amqp_port = 5673
property amqps_port = -1
property unix_path = ""
property unix_proxy_protocol = 1_u8 # PROXY protocol version on unix domain socket connections
Expand All @@ -20,7 +20,7 @@ module LavinMQ
property tls_ciphers = ""
property tls_min_version = ""
property http_bind = "127.0.0.1"
property http_port = 15672
property http_port = 15673
property https_port = -1
property http_unix_path = ""
property http_systemd_socket_name = "lavinmq-http.socket"
Expand Down
13 changes: 13 additions & 0 deletions src/lavinmq/federation/link.cr
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ module LavinMQ
@downstream_connection.try &.close
upstream_uri = named_uri(@upstream.uri)
local_uri = named_uri(@local_uri)
params = upstream_uri.query_params
pp "creating 3"
params["product"] = "LavinMQ"
params["product_version"] = LavinMQ::VERSION.to_s
upstream_uri.query = params.to_s
::AMQP::Client.start(upstream_uri) do |c|
@upstream_connection = c
::AMQP::Client.start(local_uri) do |p|
Expand Down Expand Up @@ -301,7 +306,10 @@ module LavinMQ
private def cleanup
upstream_uri = @upstream.uri.dup
params = upstream_uri.query_params
pp "creating 1"
params["name"] ||= "Federation link cleanup: #{@upstream.name}/#{name}"
params["product"] = "LavinMQ"
params["product_version"] = LavinMQ::VERSION.to_s
upstream_uri.query = params.to_s
::AMQP::Client.start(upstream_uri) do |c|
ch = c.channel
Expand Down Expand Up @@ -353,6 +361,11 @@ module LavinMQ
@downstream_connection.try &.close
upstream_uri = named_uri(@upstream.uri)
local_uri = named_uri(@local_uri)
params = upstream_uri.query_params
pp "creating 2"
params["product"] = "LavinMQ"
params["product_version"] = LavinMQ::VERSION.to_s
upstream_uri.query = params.to_s
::AMQP::Client.start(upstream_uri) do |c|
@upstream_connection = c
::AMQP::Client.start(local_uri) do |p|
Expand Down
17 changes: 14 additions & 3 deletions static/js/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,20 @@ function updateConnection (all) {
const cp = item.client_properties
document.getElementById('cp-name').textContent = cp.connection_name
document.getElementById('cp-capabilities').textContent = DOM.jsonToText(cp.capabilities)
document.getElementById('cp-product').textContent = cp.product
document.getElementById('cp-platform').textContent = cp.platform
document.getElementById('cp-version').textContent = cp.version
if (cp.product_version) {
document.getElementById('cp-product').appendChild(document.createElement('span')).textContent = cp.product
document.getElementById('cp-product').appendChild(document.createElement('br'))
document.getElementById('cp-product').appendChild(document.createElement('small')).textContent = 'Verison: ' + cp.product_version
} else {
document.getElementById('cp-product').textContent = cp.product
}
if (cp.platform_version) {
document.getElementById('cp-platform').appendChild(document.createElement('span')).textContent = cp.platform
document.getElementById('cp-platform').appendChild(document.createElement('br'))
document.getElementById('cp-platform').appendChild(document.createElement('small')).textContent = 'Verison: ' + cp.platform_version
} else {
document.getElementById('cp-platform').textContent = cp.platform
}
const infoEl = document.getElementById('cp-information')
if (cp.information && cp.information.startsWith('http')) {
const infoLink = document.createElement('a')
Expand Down
4 changes: 0 additions & 4 deletions views/connection.ecr
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@
<th>Platform</th>
<td id="cp-platform"></td>
</tr>
<tr>
<th>Version</th>
<td id="cp-version"></td>
</tr>
<tr>
<th>Information</th>
<td id="cp-information"></td>
Expand Down

0 comments on commit 41ec0b4

Please sign in to comment.