-
Notifications
You must be signed in to change notification settings - Fork 31
Add sample for message content transformation #40
Conversation
@@ -0,0 +1,18 @@ | |||
# Log file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need this file. We can add whatever is missing into the main gitignore file
# transforming-message-content | ||
# Message Transformation | ||
|
||
This guide demonstrates how to transform a request message payload to a different format expected by the back-end service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a continuation of an integration tutorial can we rephrase and update sections thinking that a user is going through this example in order?
//Define endpoint for the backen service. | ||
http:Client hospitalEP = new("http://localhost:9090"); | ||
|
||
//Constants for request paths. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Constants for request paths. | |
// Constants for request paths. |
import ballerina/http; | ||
import ballerina/log; | ||
|
||
//Define endpoint for the backen service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Define endpoint for the backen service. | |
// Define endpoint for the backen service. |
const CLEMENCY_EP_PATH = "/clemency/categories/"; | ||
const PINE_VALLEY_EP_PATH = "/pinevalley/categories/"; | ||
|
||
//Constant for error code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Constant for error code. | |
// Constant for error code. |
path: "/categories/{category}/reserve" | ||
} | ||
resource function makeReservation(http:Caller caller, http:Request request, string category) { | ||
//Extract payload from the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Extract payload from the request. | |
// Extract payload from the request. |
...rials/transforming-message-content/message_transformation_service/message_transformation.bal
Show resolved
Hide resolved
} | ||
} | ||
|
||
//Function to create the error response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Function to create the error response. | |
// Function to create the error response. |
"appointment_date": "2017-04-02" | ||
} | ||
``` | ||
However, the format of the message required by the backend service as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, the format of the message required by the backend service as follows: | |
However, the format of the message required by the backend service is as follows: |
Improve Travis config
Fix README.md for observability changes
Purpose