I need to check whether the message is seen or not when displaying it, in order to do some styling like conditional coloring or bold/normal fonts. But actually it is not clear yet to me how the mailserver with javamail controls this issue using the boolean isSeen value. the question is: On which action does this boolean value change from false to true, should I interfere somewhere here or its a javamail issue.
Assuming you're using IMAP, it's pretty much up to the IMAP server, but generally it happens when you fetch some content from the message, not just headers.
Related
I have some interaction that returns an ephemeral message with components. From those components, I want to be able to reply with a non ephemeral message (replacing the ephemeral message). I know it used to be possible, because many times while I was coding my application, I forgot to set the options flag in some replies, and that made the message turns to visible for all. But now, when I try to reply with a message without specifying the flag, it doesn't change and still display the reply in a ephemeral message.
I have heard that Discord added a new parameter about ephemerality in the interaction format to have a proper support. I think my issue is linked to that, and even tho flags options still work, I must use that parameter for my needs. However, the documentation is not updated yet.
Is it still possible to do that, and is there somewhere I can find information about the said parameter?
You cannot change a reply from ephemeral to public. A suggestion I have would be to simply follow up with a new message. If you are trying to make it public to ephemeral, you can delete the original reply. You can't however do it the other way around, since the user has to manually delete it
interaction.reply({
content: "ephemeral message",
ephemeral: true
}
// you can use any event, but I am using setTimeout
setTimeout(() => {
// interaction.deleteReply() --- only use if it starts out public
interaction.followUp({
content: "public message",
ephemeral: false
})
}, 3000)
I have this simple route in my RouteBuilder.
from("amq:MyQueue").routeId(routeId).log(LoggingLevel.DEBUG, "Log: ${in.headers} - ${in.body}")
As stated in the doc for HTTP-component:
Camel will store the HTTP response from the external server on the OUT body. All headers from the IN message will be copied to the OUT message, ...
I would like to know if this concept also applies to amq-component, routeId, and log? Is it the default behaviour, that IN always gets copied to OUT?
Thank you,
Hadi
First of all: The concept of IN and OUT messages is deprecated in Camel 3.x.
This is mentioned in the Camel 3 migration guide and also annotated on the getOut method of the Camel Exchange.
However, it is not (yet) removed, but what you can take from it: don't care about the OUT message. Use the getMessage method and don't use getIn and getOut anymore.
To answer your question:
Yes, most components behave like this
Every step in the route takes the (IN) message and processes it
The body is typically overwritten with the new processing result
The headers typically stay, new headers can be added
So while the Camel Exchange traverses the route, typically the body is continuously updated and the header list grows.
However, some components like aggregator create new messages based on an AggregationStrategy. In such cases nothing is copied automatically and you have to implement the strategy to your needs.
I posted the following Feature Request to the azure-sdk, but not sure if that was the correct place for getting a response, so reposting here.
https://github.com/Azure/azure-sdk-for-net/issues/20764
When processing a document against a custom trained model, when a value is present but not able to be translated (such as a signature), would it be possible to include something in the response to identify it as having a value though it wasn't able to be processed?
The specific use case is that our client needs to know that a document was signed by the parties involved. Without this feature, someone will be required to manually review thousands of document images per week to verify that they have been signed. In testing we have found that very few signatures are being translated any way, so the string response is coming back as null.
Thank you,
Rich
For Form Recognizer when a value is not detected although it is present it will be extracted as Null as Form Recognizer is not aware that a value exists it did not detect it. In case of signature this is usually due to the signature being unreadable and just a scribble.
A route which polls for files has an interceptor written as below. We wanted to know the total time processed. So we logged the startTime in header.
We observed that the startTime never changes. This code is inside a RouteBuilder::configure method. I then moved the code to a bean and call the bean from the interceptor. Wanted a bit more clarity, reading the camel documenation on the interceptor, I am still not clear, why this does not work
interceptFrom()
.setHeader("fileName",
regexReplaceAll(simple("${file:onlyname.noext.single}"),
"[^a-zA-z\\d]", ""))
.setHeader("startTime", constant(System.currentTimeMillis()))
Because this header is a constant that is set when the route is "constructed" and it never changes during runtime. So it stays the same constant value for every message processed.
See the Camel docs for constant. You can't set dynamic values with it.
But #claus-ibsen added a comment that there is already a message header with the creation timestamp of the exchange. You can just use it.
simple("${in.header.CamelCreatedTimestamp}")
Far as I understand, PUT request is not supposed to return any content.
Consider the client wants to run this pseudo code:
x = resource.get({id: 1});
x.field1 = "some update";
resource.put(x);
x.field2 = "another update";
resource.put(x);
(Imagine I have an input control and a button "Save", this allows me to change a part of object "x" shown in an input control, then on button click PUT changes to server, then continue editing and maybe "save" another change to "x")
Following different proposals on how to implement optimistic locking in REST APIs, the above code MUST fail, because version mark (however implemented) for "x" as returned by get() will become stale after put().
Then how do you people usually make it work?
Or do you just re-GET objects after every PUT?
You can use "conditional" actions with HTTP, for example the If-Match header described here:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24
In short: You deliver an ETag with the GET request, and supply this ETag back to the server in the If-Match header. The server will respond with a failure if the resource you are trying to PUT has another ETag. You can also use simple timestamps with the If-Unmodified-Since header.
Of course you will have to make your server code understand conditional requests.
For multiple steps, the PUT can indeed return the new representation, it can therefore include the new ETag or timestamp too. Even if the server does not return the new representation for a PUT, you could still use the timestamp from the response with an If-Unmodified-Since conditional PUT.
Here is probably what I was looking for: https://www.rfc-editor.org/rfc/rfc7231#section-4.3.4
They implicitly say that we CAN return ETag from PUT. Though only in the case server applied the changes as they were given, without any corrections.
However this raises yet another question. In real world app PUT caller will run asynchronously in JS gui, like in my example in the question. So, Save button might be pressed several times with or without entering any changes. If we don't use optimistic locking, then supposed PUT idempotency makes it safe to send another PUT query with each button click, as long as the last one wins (but actually if there were changes then it's not guaranteed, so the question remains).
But with optimistic locking, when first PUT succeeds, it returns updatred ETag, ok? And if there is another PUT request running, still with outdated tag version, that latter request will get 412 and the user will see a message "someone else changed the resource" - but actually it was our former changes.
What do you usually do to prevent that? Disable the Save button until its request is fully completed? What if it times out? Or do you think it's acceptable to see concurrent-change error message if it was a timeout, because the stability is already compromised anyway?