Comments (6)
Hi @fr-kshibata are you able to share the code you're using to consume the messages?
from sqs-consumer.
var app = Consumer.create({
queueUrl: sqs.url,
handleMessage: function (message, done) {
var poster = formatString(message);
console.log(poster);
poster = JSON.parse(poster).Body;
client.post('/sqs/', poster, function (err, req, res, obj) {
if(err)
callback(err,null);
else {
console.log(obj);
}
});
done();
},
sqs: new AWS.SQS()
});
app.on('error', function (err) {
callback(err.message, null);
});
app.start();
from sqs-consumer.
I think the problem is sqs consumer sends an error if there is no more sqs message that can be received, but since this code is called by the restify.createJsonClient, then it still works even though there is no more message to be received
from sqs-consumer.
Can you show me where the callback
variable comes from in that code?
Is that entire block running inside a function?
You really only want to have one consumer in your application. The error
event shouldn't be connected to a particular callback, otherwise you risk that callback being called twice.
The client doesn't send an error if there are no more messages on the queue. It just sits and keeps polling.
from sqs-consumer.
var client = restify.createJsonClient({
url: 'http://localhost:8080'
});
console.log(client.url.href);
sqsFunction(client, aws, sqs, function (err,req,res,obj) {
if (err)
console.log(err.message);
});
from sqs-consumer.
I removed the if(err) callback(err,null)
and looks like its ok now
thanks @robinjmurphy
from sqs-consumer.
Related Issues (20)
- Drop support for node 14 HOT 1
- [Bug]: The security token included in the request is invalid
- Allow the option `visibilityTimeout` to be configured after initialisation HOT 1
- [Bug]: The options parameter is not optional in the code HOT 1
- Configure consumer to use a SQS client that gets credentials using sts.assumeRole and post refresh
- [Bug]: heartbeatInterval is not working as expected HOT 3
- Message type is not exposed HOT 7
- Fire an event when the Consumer is started HOT 1
- [Bug]: `abort: true` raises errors when AWS SQS is polling for messages HOT 7
- [Bug]: Event listener on .once is called multiple times HOT 4
- Add the ability to programmatically update batchSize and waitTimeSeconds HOT 1
- Log a debug message whenever `.emit` is called HOT 1
- Trigger a debug message periodically while the consumer is processing messages HOT 1
- Remove debug module in favour of node in-builts HOT 1
- [Bug]: TypeError: Cannot set property message of [object Object] which has only a getter HOT 7
- handleMessage does not allow for an injected process method HOT 3
- [Feature]: Support none standard errors - "Cannot set property message of which has only a getter" HOT 7
- Drop support for Node 16 HOT 2
- [Bug]: High CPU usage HOT 1
- create a version of consumer with the aws sdk version for json HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqs-consumer.