AWS SQS - inserting a single message but can only fetch a list?2019 Community Moderator ElectionSend message using MSMQ between two EC2 instancesWhy not inherit from List<T>?Amazon SQS Dead Letter Queue: Is it really dead letter or poison?NetMQ - messages only work on reply to incoming message, not to other porthandling multiple identical messages in aws sqsHow to accommodate Amazon FIFO SQS in Laravel queue?Feeding SQS Queues available in two different AWS AccountsWhat's the best architecture to use in this case? SQS? SNS? Combination of both?PDF, HTML and SVG conversions are not working in Aspose.CellsIAM Policy variables not recognised - $cognito-identity.amazonaws.com:sub
Is it possible to avoid unpacking when merging Association?
Word for a person who has no opinion about whether god exists
PTIJ: Should I kill my computer after installing software?
Reversed Sudoku
Definition of Statistic
Single word request: Harming the benefactor
What's wrong with this bogus proof?
What wound would be of little consequence to a biped but terrible for a quadruped?
Error during using callback start_page_number in lualatex
How to write ı (i without dot) character in pgf-pie
What was the Kree's motivation in Captain Marvel?
Was Luke Skywalker the leader of the Rebel forces on Hoth?
How to draw cubes in a 3 dimensional plane
When a wind turbine does not produce enough electricity how does the power company compensate for the loss?
What does "the touch of the purple" mean?
Is it "Vierergruppe" or "Viergruppe", or is there a distinction?
An alternative proof of an application of Hahn-Banach
Bash script should only kill those instances of another script's that it has launched
How do I express some one as a black person?
Recommendation letter by significant other if you worked with them professionally?
Do I really need to have a scientific explanation for my premise?
NASA's RS-25 Engines shut down time
Does this video of collapsing warehouse shelves show a real incident?
Shifting between bemols (flats) and diesis (sharps)in the key signature
AWS SQS - inserting a single message but can only fetch a list?
2019 Community Moderator ElectionSend message using MSMQ between two EC2 instancesWhy not inherit from List<T>?Amazon SQS Dead Letter Queue: Is it really dead letter or poison?NetMQ - messages only work on reply to incoming message, not to other porthandling multiple identical messages in aws sqsHow to accommodate Amazon FIFO SQS in Laravel queue?Feeding SQS Queues available in two different AWS AccountsWhat's the best architecture to use in this case? SQS? SNS? Combination of both?PDF, HTML and SVG conversions are not working in Aspose.CellsIAM Policy variables not recognised - $cognito-identity.amazonaws.com:sub
I'm using .Net core to access an SQS queue and get a message from that queue.
Everything works fine.
For inserting a message :
var sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = queueName;
sendMessageRequest.MessageBody = message;
sqs.SendMessage(sendMessageRequest);
Notice that I can only insert a single message :
However when I was looking at the ReceieveMessage
method :
public static void GetMessage(AmazonSQSClient sqs , string queueName )
{
var receiveMessageRequest = new ReceiveMessageRequest QueueUrl = queueName ;
var receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
I've noticed that I can only get a list :
Question:
I don't understand how come I can insert a single message , but read a list of messages ?
Even if I have many messages in my queue , this code ^ only fetches one message :
Where I have 6 messages :
c# amazon-web-services .net-core amazon-sqs
add a comment |
I'm using .Net core to access an SQS queue and get a message from that queue.
Everything works fine.
For inserting a message :
var sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = queueName;
sendMessageRequest.MessageBody = message;
sqs.SendMessage(sendMessageRequest);
Notice that I can only insert a single message :
However when I was looking at the ReceieveMessage
method :
public static void GetMessage(AmazonSQSClient sqs , string queueName )
{
var receiveMessageRequest = new ReceiveMessageRequest QueueUrl = queueName ;
var receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
I've noticed that I can only get a list :
Question:
I don't understand how come I can insert a single message , but read a list of messages ?
Even if I have many messages in my queue , this code ^ only fetches one message :
Where I have 6 messages :
c# amazon-web-services .net-core amazon-sqs
add a comment |
I'm using .Net core to access an SQS queue and get a message from that queue.
Everything works fine.
For inserting a message :
var sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = queueName;
sendMessageRequest.MessageBody = message;
sqs.SendMessage(sendMessageRequest);
Notice that I can only insert a single message :
However when I was looking at the ReceieveMessage
method :
public static void GetMessage(AmazonSQSClient sqs , string queueName )
{
var receiveMessageRequest = new ReceiveMessageRequest QueueUrl = queueName ;
var receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
I've noticed that I can only get a list :
Question:
I don't understand how come I can insert a single message , but read a list of messages ?
Even if I have many messages in my queue , this code ^ only fetches one message :
Where I have 6 messages :
c# amazon-web-services .net-core amazon-sqs
I'm using .Net core to access an SQS queue and get a message from that queue.
Everything works fine.
For inserting a message :
var sendMessageRequest = new SendMessageRequest();
sendMessageRequest.QueueUrl = queueName;
sendMessageRequest.MessageBody = message;
sqs.SendMessage(sendMessageRequest);
Notice that I can only insert a single message :
However when I was looking at the ReceieveMessage
method :
public static void GetMessage(AmazonSQSClient sqs , string queueName )
{
var receiveMessageRequest = new ReceiveMessageRequest QueueUrl = queueName ;
var receiveMessageResponse = sqs.ReceiveMessage(receiveMessageRequest);
I've noticed that I can only get a list :
Question:
I don't understand how come I can insert a single message , but read a list of messages ?
Even if I have many messages in my queue , this code ^ only fetches one message :
Where I have 6 messages :
c# amazon-web-services .net-core amazon-sqs
c# amazon-web-services .net-core amazon-sqs
asked Mar 6 at 15:22
Royi NamirRoyi Namir
76.1k99333596
76.1k99333596
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If you want to send multiple messages in a single API call, there is SendMessageBatch
documented here and here.
If you want to receive only a single message per request, you would set ReceiveMessageRequest.MaxNumberOfMessages
to 1
.
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg
– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you settingWaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.
– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
@RoyiNamir yes, but you should always setWaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.
– Michael - sqlbot
Mar 7 at 9:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026522%2faws-sqs-inserting-a-single-message-but-can-only-fetch-a-list%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want to send multiple messages in a single API call, there is SendMessageBatch
documented here and here.
If you want to receive only a single message per request, you would set ReceiveMessageRequest.MaxNumberOfMessages
to 1
.
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg
– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you settingWaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.
– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
@RoyiNamir yes, but you should always setWaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.
– Michael - sqlbot
Mar 7 at 9:05
add a comment |
If you want to send multiple messages in a single API call, there is SendMessageBatch
documented here and here.
If you want to receive only a single message per request, you would set ReceiveMessageRequest.MaxNumberOfMessages
to 1
.
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg
– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you settingWaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.
– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
@RoyiNamir yes, but you should always setWaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.
– Michael - sqlbot
Mar 7 at 9:05
add a comment |
If you want to send multiple messages in a single API call, there is SendMessageBatch
documented here and here.
If you want to receive only a single message per request, you would set ReceiveMessageRequest.MaxNumberOfMessages
to 1
.
If you want to send multiple messages in a single API call, there is SendMessageBatch
documented here and here.
If you want to receive only a single message per request, you would set ReceiveMessageRequest.MaxNumberOfMessages
to 1
.
answered Mar 6 at 15:34
Mark BMark B
103k16163177
103k16163177
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg
– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you settingWaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.
– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
@RoyiNamir yes, but you should always setWaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.
– Michael - sqlbot
Mar 7 at 9:05
add a comment |
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg
– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you settingWaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.
– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
@RoyiNamir yes, but you should always setWaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.
– Michael - sqlbot
Mar 7 at 9:05
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (
while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg– Royi Namir
Mar 6 at 15:36
Thanks , but How come AWS gives me only 1 message , while I have 5 in queue (
while I'm explicitly asking for 5
)? i.imgur.com/n3XVtGa.jpg– Royi Namir
Mar 6 at 15:36
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you setting
WaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.– Mark B
Mar 6 at 15:45
You can't explicitly ask SQS for 5. You are most likely setting the Max messages to 5, but that doesn't guarantee you will get 5, it just guarantees you will never get more than 5. What are you setting
WaitTimeSeconds
to? If that is very low it may be affecting how SQS is bundling up messages for you.– Mark B
Mar 6 at 15:45
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
Got it. it's AWS that determines how much to fetch up to this max boundry.
– Royi Namir
Mar 6 at 15:46
1
1
@RoyiNamir yes, but you should always set
WaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.– Michael - sqlbot
Mar 7 at 9:05
@RoyiNamir yes, but you should always set
WaitTimeSeconds
to 20 unless you have a specific reason not to. Not setting this at all will increase your chances of getting fewer messages or even 0 messages, and setting it does not cause SQS to actually wait that long unless there really are no messages available -- in which case, it will wait that long and then return 0, or will return the next message to arrive immediately upon its arrival. This dramatically reduces operational costs and improves overall performance and should have been the default behavior.– Michael - sqlbot
Mar 7 at 9:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026522%2faws-sqs-inserting-a-single-message-but-can-only-fetch-a-list%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown