Customize OSB Mail alert body content - oracle

I am using Mail as alert-destination in OSB. From proxy service I am calling the alert destination and mail is being sent successfully.
However, the mail content is showing the details of service, destination, timestamp, server name etc details.
I just want to have the payload information in the mail body.
Is therey any way to customize the mail body when adding alert action in a proxy service?
Thanks in advance

The Alert action is very basic, and the email destination isn't really designed to be consumed by humans directly.
You're probably better off alerting to a JMS destination, then dequeuing it using a proxy to transform it into exactly what you want, then route to an SMTP Messaging business service to deliver the email (presumably formatted in HTML).

Related

How to ensure server has sent emails in Jmeter

I'm running a load test in jmeter for a registration scenario. In that scenario, there is a situation where an OTP is sent for the email address provided. Is there a way to ensure that the email has been sent when running the test script. All the email addresses i use are dummy addresses getting from a CSV file. I do not wish to read the email or get any data from it. I simply am required to know if the emails has been sent when a certain http request is hit.
I don't think you can "know if the emails has been sent" without actually receiving it so instead of "dummy" emails you can:
Set up a local mail server, i.e. test-mail-server or real email address(es)
Configure your application to use this test mail server (or real mail server) for sending emails
Configure JMeter to read emails from this test mail server using Mail Reader Sampler. Check out How to Create a JMeter Script to Check Email During Registration AND Grab the Confirmation URL article for more information.

In a group chat, should the new message event (websocket) be sent by the client or the API?

I have a doubt, in a group chat system that has a database with a rest API, who should issue the event of a new message?
The client or the endpoint to create the new message?
For example: X user sends a message to group Y, then uses the api endpoint api.com/message-create and that endpoint emits the message-create event through websocket
Example 2: X user sends a message to group Y, then uses the api api.com/message-create endpoint and the endpoint does not emit the message-create event, but was emitted when the user pressed the send message button
I still don't quite understand if it would occupy more websocket channels to achieve that, if a global one is enough, etc.
The server should be responsible for communication logic. So your first example is better.
But: why do you use two communication channels for sending an creating messages?
If you use websocket, you don't need create a message from a client by using additional rest endpoint.
This approach is prone to errors. For example if the client will loose network connection after sending message through websocket and before executing call to the REST endpoint?
The message will not be stored in a database.
Your flow should looks as follows:
User clicks the send button.
Message is send through the websocket.
Message is stored in the database asynchronously (you can do it directly from communication server, or use rest endpoint)
Emit "new message" event to the group.

Alternatives of MQJExplorer tool for capturing request and sending response

I have an application which uses IBM MQ to send out the request in a queue manager to a particular system B.
The response corresponding to that request is then received back from system B by the application in a sync call and then further business processing happens.
Since we are working on the offshore region, we do not actually send out the request to system B but rather capture it ourselves using the MQJExplorer tool and send back the response, which kind of simulates the prod. behaviour.
The problem here is, or i would say, the overhead is that we have to manually open the mqjexplorer tool, check the request, take a particular attribute from the request(lets say ID), and send back ID+1 so that the application recognizes the response is for ID-1 request.
I would like to know if this particular thing can be automated, with some other tool, where i can define like whenever any such kind of request is received in for eg: MQ001 queue manager and its REQ queue, just extract the ID attribute, do a ID+1 and send back the response in RESP queue of same qm.
There are a pair of IBM supplied samples that come with IBM MQ:-
amqsreq0.c - Sample C program that puts request messages to a message queue and shows the replies (example using REPLY queue)
amqsecha.c - Sample C program - echo messages to reply to queue
They are supplied to allow you to try out a request/reply application.
You already have the equivalent app to do the job that amqsreq0.c does, and you could adapt amqsecha.c to extract your ID attribute, increment it, and then the sample already has the code to send the reply back.
It can be automated by running as a triggered application too.
If 'C' language is not your thing and prefer Java then have a read of a blog posting I did in 2017. It is a complete request/reply scenario with 2 applications: BEServer01.java and RQClient01.java
You can modify BEServer01.java to your liking (and remove the SQL code). BEServer01.java contains all of the code for getting a request message and sending a reply message. Simply replace the variable 'replyText' contents with the reply message that you want.
If you are not a programmer then there is another option but it does not modify the message contents. MQ Visual Edit has a component called: SIM Server. Its purpose is to simulate a server-side component. You configure what 'request' queue to get the messages from and what the reply message text will be. When a messages lands on the request queue, the SIM Server will retrieve it and send the reply message to the queue & queue manager specified in the MQMD's ReplyToQueueName and ReplyToQueueManagerName fields.

Use TwiMl templates for sending outbound sms

I am new to Twilio. We have a requirement in the project as follow -
Send an outbound SMS to a given number. The message body is static text and should be defined using a template on Twilio(TwiML), so that client can change the message body anytime without making any changes in the backend application.
I have gone through the Twilio documentation to understand how to use TwiML, but couldn't find any document or article which explains how to use TwiML for sending an outbound SMS. Currently I am using following code to send a SMS and the message is configured in the Spring Boot application.properties file.
Message message = Message.creator(new PhoneNumber(phoneNumber),
new PhoneNumber(fromPhoneNumber),
messageBody).setStatusCallback(URI.create(callBackUrl)).create();
Does anyone know how to use TwiML template to send an outbound SMS. Can someone help me to solve this problem. Thank you.
What is Twiml?
Twiml is instructions for Twilio, how to respond to an incoming phone call,SMS, etc...
What is Twiml
It is not for outbound actions.
To initiate an SMS , you should use the Twilio api which is what you are doing when you use the sdk such as Message.creator

Spring JavaMailSenderImpl logs into SMTP server every time for sending emails, causing latency in web application

I am using Google's SMTP server to send transactional emails from my web application, using Spring's JavaMailSenderImpl class.
The problem is: the send Email function send(SimpleMailMessage simpleMessage), is authenticating on the SMTP for every email. This is slowing down the web server, as I am sending the emails synchronously (which is of course a bad idea, I should rather be sending the emails asynchronously using a queue.)Nevertheless my question is:
Is there a way to save the SMTP auhenitcation during the first email and use it for all the subsequent emails.
Use the method send(SimpleMailMessage[] messages) of JavaMailSenderImpl. It will reuse the same transport for each message.

Resources