Iam trying to send a message to activemq using pythons stompclient.
https://bitbucket.org/hozn/stompclient/wiki/User%20Documentation
If there is a better library for this Im open to suggestions.
If i change to ip or port it will fail to connect so im assuming that the connection is working. There are no errors when I run this code its just that I see no messages on the queue. I think the destination path is possibly where it is failing the PhysicalName of the activemq queue is in this pattern 'abc.queue_name'.
I've tried the following destinations
/queue/abc/queue_name
/queue/abc.queue_name
abc.queue_name
Any suggestions are greatly appreciated.
Thanks
from stompclient import PublishClient
client = PublishClient('IP', 53680)
response = client.connect('defaultPassword', 'defaultUser')
reponse1 = client.send('/queue/abc/queue_name', 'bla')
time.sleep(5)
Have you checked the webconsole to see if your Queue was created by the send?
You should also try adding a request id onto the send and waiting for a response, this will ensure that the broker has enough time to get the sent data before you client code disconnects.
You might also want to check the Broker logs to see if any errors are logged or any security warnings in case the user doesn't have publish rights.
Added this property to the activemq.xml file and im now seeing messages on the queue via the web console.
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
Related
We are using twilio for sending messages but as Twilio(Text Messaging) integration was shutting down we deployed the integration using cloud run by following steps from https://github.com/GoogleCloudPlatform/dialogflow-integrations/tree/master/twilio#readme
After deployment messages were sending successfully but now suddenly we are getting errors in twilio like
Some messages are sending successfully and for some messages we are getting error.can anybody help me in this.thanks in advance
According to Twillio docs there might be some possible causes for Unreachable destination handset
1.The destination handset you are trying to reach is switched off or otherwise unavailable.
2.The device you are trying to reach does not have sufficient signal
3.The device cannot receive SMS (for example, the phone number belongs to a landline)
4.There is an issue with the mobile carrier
Possible Solutions
The first step to troubleshooting this issue is to attempt to replicate the problems.
Attempt to send another test message to this user via a REST API request, or through the API Explorer in the Twilio Console.
I want to get notifications by email for errors on my google cloud service.
It seemed pretty easy to setup. I just hit turn on notifications in Error Reporting in Stackdriver for all services (I only have 1 service).
I created some errors for testing, but didnt receive any emails.
Went into alert policy and profiles and added email notification as a channel. Still not notifications via email.
What am I doing wrong?
I think the best way to check if the notification is actually being sent is to post a test error message manually to the error reporting API.
First, verify that error notifications are available for the project, and then, run the following command on your cloud shell:
gcloud beta error-reporting events report --verbosity=debug --service Manual --service-version test1 \
--message "java.lang.TestError: msg
at com.example.TestClass.test(TestClass.java:51)
at com.example.AnotherClass(AnotherClass.java:25)"
You should receive an email from StackdriverNotifications-noreply#google.com
If you receive the notification for the test, your other errors might be misconfigured. If you don't receive it, then you might need to verify that the noreply address is not being blocked by your provider/filters.
I've been trying to use the javacscript version of the Eclipse Paho MQTT client to access the Google IOTCore MQTT Bridge, as suggested here:
https://cloud.google.com/iot/docs/how-tos/mqtt-bridge
However, whatever I do, any attempt to connect with known good credentials (working with other clients) results in this connection error:
errorCode: 7, errorMessage: "AMQJS0007E Socket error:undefined."
Not much to go on there, so I'm wondering if anyone has ever been successful connecting to the MQTT Bridge via Javascript with Eclipse Paho, the client implementation suggested by Google in their documentation.
I've gone through their troubleshooting steps, and things seem to be on the up and up, so no help there either.
https://cloud.google.com/iot/docs/troubleshooting
I have noticed that in their docs they have sample code for Java/Python, etc, but not Javascript, so I'm wondering if it's simply not supported and their documentation just fails to mention as such.
I've simplified my code to just use the 'Hello World' example in the Paho documentation, and as far as I can tell I've done things correctly (including using my device path as the ClientID, the JWT token as the password, specifying an 'unused' userName field and explicitly requiring MQTT v3.1.1).
In the meantime I'm falling back to polling via their HTTP bridge, but that has obvious latency and network traffic shortcomings.
// Create a client instance
client = new Paho.MQTT.Client("mqtt.googleapis.com", Number(8883), "projects/[my-project-id]/locations/us-central1/registries/[my registry name]/devices/[my device id]");
// set callback handlers
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
// connect the client
client.connect({
mqttVersion: 4, // maps to MQTT V3.1.1, required by IOTCore
onSuccess:onConnect,
onFailure: onFailure,
userName: 'unused', // suggested by Google for this field
password: '[My Confirmed Working JWT Token]' // working JWT token
function onFailure(resp) {
console.log(resp);
}
// called when the client connects
function onConnect() {
// Once a connection has been made, make a subscription and send a message.
console.log("onConnect");
client.subscribe("World");
message = new Paho.MQTT.Message("Hello");
message.destinationName = "World";
client.send(message);
}
// called when the client loses its connection
function onConnectionLost(responseObject) {
if (responseObject.errorCode !== 0) {
console.log("onConnectionLost:"+responseObject.errorMessage);
}
}
// called when a message arrives
function onMessageArrived(message) {
console.log("onMessageArrived:"+message.payloadString);
}
I'm a Googler (but I don't work in Cloud IoT).
Your code looks good to me and it should work. I will try it for myself this evening or tomorrow and report back to you.
I've spent the past day working on a Golang version of the samples published on Google's documentation. Like you, I was disappointed to not see all Google's regular languages covered by samples.
Are you running the code from a browser or is it running on Node.JS?
Do you have a package.json (if Node) that you would share too please?
Update
Here's a Node.JS (JavaScript but non-browser) that connects to Cloud IoT, subscribes to /devices/${DEVICE}/config and publishes to /devices/${DEVICE}/events.
https://gist.github.com/DazWilkin/65ad8890d5f58eae9612632d594af2de
Place all the files in the same directory
Replace values in index.js of the location of Google's CA and your key
Replaces [[YOUR-X]] values in config.json
Use "npm install" to pull the packages
Use node index.js
You should be able to pull messages from the Pub/Sub subscription and you should be able to send config messages to the device.
Short answer is no. Google Cloud IoT Core doesn't support WebSockets.
All the JavaScript MQTT libraries use WebSocket because JavaScript is restricted to perform HTTP requests and WebSocket connections only.
I'm trying to use the WSO2 Message Broker solution but i have some problems/questions that i hope someone can help me.
We detect a problem on a Queue message counter, that counts 100 messages but after we open it don't show up any message. This problem occurs when the Message Broker end's abruptly, and we don't know if it's only a problem with the counter or if is a message lost problem.
Other question is if it's possible to run this solution on a Websphere Application Server?
Here is the logs and image from Message Broker console logs and Console files
Thank you.
I am using Azure cloud service bus to send and receive messages using AMQP protocol. I have installed proton-c libraries in my debian-linux. I tried the below program to send and receive message from the queue. My requirement is instead of queue I have use topics. Please anyone give me a sample program to use topics in Azure cloud.
import sys, optparse
from proton import *
messenger = Messenger()
message = Message()
message.address = "amqps://owner:<<key>>#namespace.servicebus.windows.net/queuename"
message.body = "sending message to the queue"
messenger.put(message)
messenger.send()
Instead of queuename in above url if I give the topic name then the program running forever. Please someone help me. I am new to python programming.
I found myself the solution for this problem. I guess very few people are working in Azure Cloud so I didn't get any answers.
Here is the solution:
If we create topics in Azure service bus, it always select the checkbox "Enable Partitioning". AMQP protocol doesn't support partitioning topics/queues so I stuck with above issue. Once I deleted the topic and recreate the same topic without select the checkbox "Enable Partitioning". Its work fine. :)