I read the book Camel in Action. But I can't understand what attachment mean in its message model.
I know headers such like sender information, receiver information, or data encoding etc. However, I don't know what is mean of attachments?
Lets run through some examples
You are consuming a file, camel can create a message with contents of the file as payload and file name etc as message headers
You are consuming a jms message, camel can create a message with contents of jms message as payload and jms header etc as message headers.
You are sending simple http request, camel can crate a message with what is inside the http request as paylaod and url etc as headers
Then you have some other components
You can send an email with some text in the body and some attachments, so in this case camel creates a message with payload, headers and attachments
You can also send SOAP request with attachments, in this case also, camel creates the message with payload, headers and attachments.
But there is not many camel components which support attachment. There is few like email, soap service etc
Related
I want to be able to use Logic Apps to put/post messages in an Azure Storage Queue, because I want to make use of the Managed Identity option that HTTP Logic App acion provides.
I have a Logic App that uses HTTP action to post XML messages to the queue and I have a "Put a message on a queue" action that puts JSON message to the queue for debugging purposes.
My ultimate goal is to be able to use the HTTP action with Managed Identity as Authentication but be able to post JSON messages to the queue like the "Put a message on a queue" action is able to.
You can certainly send JSON as message body. In fact you can send any text. You just have to ensure that the text you're sending as message body must be XML safe e.g. replace < with < etc. Generally Base64 encoded string messages are sent to ensure this.
From the REST API documentation:
A message must be in a format that can be included in an XML request
with UTF-8 encoding. To include markup in the message, the contents of
the message must either be XML-escaped or Base64-encode. Any XML
markup in the message that is not escaped or encoded will be removed
before the message is added to the queue.
Here is what worked for me:
Enabled "Managed Identity" on the Logic App.
Added Storage-Queue-Contributor permissions on the storage queue.
Used utcnow('R') to get this date format ("Tue, 08 Sep 2020 12:03:08 GMT")
for x-ms-date HTTP header (no doc from MS about this).
Inserted JSON data inside
<QueueMessage>
<MessageText>
{
"car": "Audi",
"year": 1983
}
</MessageText>
</QueueMessage>
Final result in Logic App designer:
Our app (say abc) need to interact with another app (say xyz) using Tibco queues.
The xyz will listen to incoming messages in Queue1.
Then it would send back the response message Temp queue, we have populated in the request message header.
From abc, we are sending the messages to Queue1 using ProducerTemplate.
We have set the JMSReplyTo in the headers.
Now we want to receive the message which would be sent to the Temp Queue.
Along with the body, we also need the headers which xyz would be populating and sending us.
Is this possible using Producer/Consumer Template? If yes, can you highlight that pls.
If not, what is alternative?
In our application we are implementing the Send As feature from Gmail client.
https://support.google.com/mail/answer/22370
We are setting the From, To and Reply To headers accordingly to the settings that are set for the external account. Are there other headers that should be set when sending message in behave of external account? For example when we have set another SMTP server for the current external account.
Well, according to User Messages API Document, these are all the headers you need to add:
Users.messages: send
Sends the specified message to the recipients in the To, Cc, and Bcc
headers. Try it now or see an example.
This method supports an /upload URI and accepts uploaded media with
the following characteristics:
Maximum file size: 35MB Accepted Media MIME types: message/rfc822
Be sure to be authorized first, and apply best practices on sending to external accounts.
I see lots of exceptions[ClientAbortException: java.net.SocketException: Broken pipe] in
my catalina log while trying to send the response back but i am not able to tie this exception
to a particular request with a particular Inbound Message ID, Is there any way by which i can know, while sending
which response this exception is occuring in cxf ?
Try enabling SOAP logging. If you enable SOAP logging as follows, you will see SOAP requests and/or responses including HTTP headers. CXF also assigns a message ID for each request/response.
#WebService
#org.apache.cxf.annotations.Logging
public interface AssetServices {
....
}
How to Send POST method with multipart request using CAMEL
I have an application with camel setup and i need to attach documents and send and HTTP POST request.
How can i do this,
You can always write some java code with the apache httpcompenents library. see http://hc.apache.org/
It is not difficult to use