I am trying to get a message via a message id by using Boto.
This question:
Trying to Get SQS Message ID with Boto
Makes me think that Boto might have a way to get a message by a message id, but I can't find anything in the Boto documentation.
Is there anyway to get a message via message id?
No, there isn't. The SQS API does not provide a way to retrieve a message body given a message id. All you can do is read messages from the queue.
The question you link to is about how to get the message ID from a message that you have already read. That is possible and the details can be found in that message.
I dont know what exactly your problem is, however, in my case:
I am getting about 20 messages at once from Sqs and processing them asyncronously. When a message done, I want to delete it from sqs. So, I put the progressing message to a HashMap with Id value.
When I am done with message I get it from Map easily.
If you have Id of message, you should also have Message object before. And If the range of Message count is not so much you can also use Maps.
Message msg = onProcess.get(processId);
sqs.deleteMessage(new DeleteMessageRequest().withQueueUrl(queueUrl).withReceiptHandle(msg.getReceiptHandle()));
onProcess.remove(processId);
Related
Is there a way to set a message attribute of a message in an SQS queue? I am trying to examine a message sent to an SQS queue and change its value. The last line of the code below gets and prints the value.
for message in queue.receive_messages(MaxNumberOfMessages=10, AttributeNames=['All'], MessageAttributeNames=['All']):
print(message.body)
print(message.attributes)
print(message.message_attributes)
print(message.message_attributes.get('attr').get('StringValue'))
I would like a way of setting the StringValue of attr in this message. Is there any way of doing that? I would prefer a way of doing this using boto (rather than boto3).
The message attributes of an SQS message are immutable once the message has been sent to the queue. The SQS Query API (used by all client libraries) has no support for modifying a message in the queue, other than to change its visibility timeout.
I am on themoviedb.org to understand request and response for search movie. I am received api_key. When I try to use their console on the site with api_key and query. I am getting 401 error.
The detailed error message is:
status code 7
status message invalid api key
If I use the same key in my code, I dont receive any error. Can anyone please help?
This is usually caused by Apiary expecting the API key to be sent as a header as opposed to what TMDb expects (which is just a query parameter).
If you add the 'api_key' as a query parameter to your URL instead, it should work.
I'm trying to write a messaging app using PhoneGap, AngularJS and Firebase. I'm trying to work out what the correct the correct database structure should be given Firebase unusual query methods (1, 2).
I need a messages 'table' where all messages are stored, however the issue is that this is a NoSQL table, so it's quite hard to retrieve data if it's not formatted specifically.
For example, I originally considered something like /messages/{userId} to get all messages for a user, and /messages/{userId}/{partnerId} to get a specific message chain, but I can't do that because it would mean that data has to be duplicated, once for the person sending the message and once for the person receiving.
Can anyone suggest a layout which would work well with Firebase's query structure, and allows:
Retrieval of all messages to/from a user
Retrieval of a specific thread from one user to another
look in this post about data denormalizing . I faced a similar challenge and the solution which worked for me was storing all data under auto ID in specific object and if needed I stored a reference to that data in as many places as required.
Applying this to your problem, if simplified, I would go for something like this:
root/messages/{message_by_auto_id}/{message_body}
root/users/{user_id}/messages_this_user_can_see/{ref_to_message}
so If a user posts a message the app needs to save the message in messages and save the reference to that message to each friend as above.
I've implemented logging of all requests/responses using (in my AppHost.cs):
this.RequestFilters.Add(serviceLogFilter.LogRequest);
this.ResponseFilters.Add(serviceLogFilter.LogResponse);
During the logging of the request, I get the new ID from the logging table and put it into IHttpRequest.Items.
My question is: when an error occurs, like if the validation of the incoming data fails, or my business logic throws an Exception, is there a way I can customize the returned error to contain my log reference? Preferably by adding a JSON body to the error response. Alternatively, setting a custom HTTP header?
The idea is that my customer could give me a log reference if something unexcpected happens, and I would find his request and could easily reproduce the problem.
See this question on different ways to Handle exceptions from the old and New API.
To use the IHttpRequest.Items dictionary to pass data between request filters, services and response filters in the same request.
Also the InMemoryRollingRequestLogger implementation for the Request Logger plugin shows another way to be able to log all requests.
I am able to post a message successfully on a USER wall :) , from the code I am trying to get the status detail which posted thru my application .
Here is the Id for the status message I post on user wall : 557671002_10150464779501003.
When I try get the details about the status message by accessing : https://graph.facebook.com/557671002_10150464779501003 , I get a result as false.
How to get details of status.
You have to request the read_stream permission in order to extract information from a post on a users feed.
Try grabbing it using the access token:
https://graph.facebook.com/557671002_10150464779501003?access_token={a valid access token}