Skip to content

Instantly share code, notes, and snippets.

@iOnline247
Created January 4, 2020 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iOnline247/f00f29d695fb75e219f5b39318f5da68 to your computer and use it in GitHub Desktop.
Save iOnline247/f00f29d695fb75e219f5b39318f5da68 to your computer and use it in GitHub Desktop.
POST a simple message to an ActiveMQ Topic
$i = 0
while($true) {
$password = ConvertTo-SecureString "admin" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential "admin", $password
$i++
$body = "test$i"
Invoke-RestMethod -Uri "http://activemq:8161/api/message/mqttsignal?type=topic" -Method Post -ContentType "text/plain" -Credential $cred -Body $body
if (($i % 3) -eq 0) {
Start-Sleep -Milliseconds 20
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment