Tutorials A to Z » June 25, 2019

Daily Archives: June 25, 2019

Being Healthy

10 Unknown benefits of Guava

Published by:

Guava is actually a tropical fruit that grows in tropical weather. Therefore, it is not surprising that it can easily grow in the backyard and does not need special treatment of the plantation. Fruits can be consumed in its pure form. In addition, guava can be consumed in the form of freshly squeezed delicious juice. The fruit is pink and it tastes really sweet. White or red guava, scientifically called Psidium guajava, and is one of the fruits with various benefits.

Nutrient content

Fruits contain a large amount of nutrients. Each serving of guava, or about 165 grams of fruit, usually contains the following nutrients:

  • Energy value -112 kcal
  • Fat – 1.6 g
  • Sodium – 3 mg
  • Potassium – 688 mg
  • Carbohydrates – 24g
  • Cellulose – 8.9 g
  • Sugar – 15 g
  • Protein – 4.2 g
  • Vitamin A – 700 mg
  • Vitamin C – 30 grams of vitamin
  • Vitamin B6 – 10 mg
  • Calcium – 3 mg
  • Iron – 2 mg
  • Magnesium – 9 mg

For more information on the health benefits of guava during pregnancy, see the points below.

  1. The Immune system

The main advantage in the use of guava – strengthening the immune system of the body. This is due to the fact that fruits contain large amounts of vitamin C, which are beneficial for maintaining the health of the body, mainly during pregnancy, when a strong immune system is needed so that a pregnant woman cannot easily get sick.

  1. Nutrients for fetal health during pregnancy

Guava’s benefits pregnant women too as it contains folic acid, or vitamin B-9, which is recommended for pregnant women since it can help in developing the baby’s nervous system and protect the newborn from neurological disorders.

  1. Healthy and radiant skin

Guava also contains vitamin E, which is good for skin health. It can help make the skin smooth and silky and give it a healthy appearance. In addition, it will give skin radiance, help to avoid inflammation, such as acne or eczema. Therefore, guava – the best natural remedy for the skin during pregnancy.

  1. Source of Vitamin C

Guava has 4 times more vitamin C than in orange. Therefore, it help strengthening the lymphatic system. It will be able to raise the overall tone of the body and increase its resistance to adverse external influences, infections and viruses. Guava can serve as one of the best preventive measures in the period of prosperity of influenza and viral infections.

  1. Prevents dehydration

Guava contains around 80% of water which can help meet the need for body fluids. Therefore, fruits are good to avoid dehydration.This is important for a pregnant woman, as they are sharing fluid with the fetus, so there should be enough amniotic fluid.

  1. Prevents diabetes

Guava contains natural sugar. Thus, it is a good way to avoid diabetes and control blood sugar levels. This is important because the hormones of a pregnant woman usually lead to abnormal insulin levels in the blood. Guava leaf tea may help prevent spikes in blood sugar and improve symptoms in people with type 2 diabetes. A 2010 review of evidence from clinical trials and animal studies suggests that guava leaf tea may help improve insulin resistance and lower blood sugar levels.

  1. Blood pressure control

Another health benefit of guava during pregnancy will allow you to control blood pressure levels. It is easy for a pregnant woman to get hypertension due to increased blood velocity during pregnancy. Consuming guava will help reduce pressure and avoid the possibility of hypertension.

 

  1. Rich in fiber

Just like many other fruits, guava also contains a large amount of fiber. It is useful for improving the functioning of the intestines, which leads to proper digestion. In addition, it will lead to better absorption of nutrients.

  1. Improved digestion

Because fruits are rich in fiber, it is the right way to keep your digestive system healthy. Pregnant women usually experience digestive difficulties during the third trimester. Therefore, eating more fruit will improve the metabolic rate, which can also improve digestion.

  1. Prevents anemia

Guava also contains minerals that can help in the production of sufficient red blood cells. Thus, it can help avoid anemia.This is important during pregnancy, when a pregnant woman often loses minerals to feed the fetus, which leads to a state of symptoms of severe anemia.

 

Precautions and Recommendations

Despite the fact that fruits bring many benefits to a pregnant woman, there are also things to consider when eating fruits.For further explanation, see the following recommendation when deciding on the use of guava during pregnancy.

  • Avoid eating fruit if any allergic condition is detected, such as itching, redness, or a swollen face. Also, stop eating guava if you feel pain or nausea after it is consumed.
  • Use in proper portions to avoid diarrhea, as this fruit is rich in fiber. Therefore, too frequent use of guava can lead to problems with the stomach.
  • Be sure to clean the fruit from the seeds, as the seeds can cause appendicitis. Drink a lot with food to avoid choking or any unwanted problems.

These are all the health benefits of guava during pregnancy. Eat fruit every day during pregnancy. However, eat these fruits in the right amount. Thus, guava will bring optimal benefits and help avoid unwanted side effects, mainly effects that can harm the fetus.

Mule 4 Mulesoft Tutorial

Retry Mechanism – Until Success Vs Flow Reference

Published by:

Retry Mechanism – Until Success Vs Flow Reference

In mule 3 we have roll back exception strategy which enable’s the ability to retry the execution in case of error and define a separate flow to be executed once the retry count has exceeded.

In mule 4 you do have re-connection strategy which we can define on the connectors but that only retries in case of failure in connection. In Mule 4 we do not have roll back exception strategy, so in this tutorial we will be looking on how we can implement the same functionality in Mule 4.

To achieve this retry mechanism, we can use Until Successful, but the issue we will face are:

  1. We would not be able to specify any specific condition on which retry should happen . For Example: We will not be able to define retry only when HTTP status code is 202.
  2. We also cannot implement error flow, once an error has occurred. For Example: Every time an error is generated we need to send the error message on to a queue before retrying.

Scenario 1: We want to implement retry mechanism on Web service call, in case of error if HTTP status code is 502 then, API should retry its Web Service Call only 3 times.

To complete the above scenario, we will be using Flow Reference.

Flow Reference in Mule 3 was not able to call its own flow in which it was defined. But in Mule 4 you can call any flow even its own flow.

Flow Diagram:

All we need is to use is flow reference to call its own flow when an error is generated. We have moved HTTP Request to another flow “HTTPFlow” and is referred by flow reference in main flow “get:\users:test-config”.

Inside HTTPFlow we have HTTP Request call on which we have implement retry mechanism. In Error handling part, “On Error Continue” is checking for the retry count if it has reached to its max or not. Inside error flow of “On Error Continue” retry count value is getting incremented and after some seconds of sleep; flow reference will again call HTTPFlow. Once the retry count has reached to its max “On Error Continue” will no longer catch the error and the final error is throw back to its parent flow.

    <flow name="get:\users:test-config">
    <ee:transform xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd" doc:id="86de922d-7d4d-4d0a-b010-e1cf9e23a79d">
            <ee:message>
                <ee:set-payload><![CDATA[%dw 2.0
output application/json
---
{
  userID: [
    "1", 
    "2"
  ],
  userName: "Varun",
  subject: [
    "Maths", 
    "Mule", 
    "TIbco"
  ],
  class: {
    name: "Class 10"
  }
}]]></ee:set-payload>
            </ee:message>
        </ee:transform>
    <logger level="INFO" doc:name="Logger" doc:id="897eb15a-c379-4051-ae78-21ebbbf33cd1" />	
      <set-variable value="1" doc:name="SetRetryCount" doc:id="ae08693c-0c8e-4397-b5e2-235b8b288821" variableName="retryCount" />
    <flow-ref doc:name="HTTPFlow" doc:id="84ab16f4-0fa5-4ac4-a73e-80dd7ab20ea0" name="HTTPFlow"/>
    <logger level="INFO" doc:name="Logger" doc:id="92727a36-d8ed-4ea1-8616-3c0537598400" />
    </flow>
  <flow name="HTTPFlow" doc:id="610bee6d-59f2-4f77-a29e-d60b88aaea01" >
    <logger level="INFO" doc:name="Logger" doc:id="38537854-3f21-48a7-a6a6-31907d8bca90" message="Calling HTTP request count - #[(vars.retryCount default 0)]" />
    <http:request method="GET" doc:name="HTTPCall" doc:id="c766093c-c7ac-444f-914d-cd4d1b70676d" config-ref="HTTP_Request_configuration" path="/abc">
      <reconnect />
    </http:request>
    <error-handler >
      <on-error-continue enableNotifications="true" logException="true" doc:name="On Error Continue" doc:id="8d23329f-b006-4a56-b6a7-6e33eb748957" when="#[(vars.retryCount as Number default 0) &lt; 3 and error.muleMessage.attributes.StatusCode == 503]">
        <logger level="INFO" doc:name="Logger" doc:id="1be75ffe-a4bf-4fe1-9802-ae1309d76341" message="#[error.description]"/>
        <set-variable value="#[(vars.retryCount default 0) +1]" doc:name="Increment retryCount" doc:id="a9877e1d-d1f5-4786-93e9-58126d08f3f4" variableName="retryCount"/>
        <scripting:execute doc:name="Sleep" doc:id="531bc61a-937d-4a0c-81ce-1ea0685ce64f" engine="groovy">
          <scripting:code >def duration = Long.valueOf('3000');
sleep(duration);
return message.payload;</scripting:code>
        </scripting:execute>
        <flow-ref doc:name="HTTPFlow" doc:id="3f37c302-ec9a-4751-ab4e-dcdefb2607f5" name="HTTPFlow"/>
      </on-error-continue>
    </error-handler>
  </flow>

 

Scenario 2: Here we want to implement retry mechanism on Web service call when a specific value is received. Example if a web service call returns a value 5 then retry should happen maximum 3 times else not.

Implementation:

We have moved HTTP Request to sub flow “testSub_Flow” and is referred by flow reference in its parent flow “post:\users:application\json:test-config”.

Inside testSub_Flow  we are using flow reference to call itself. Once we have received the response from web service call “Request“, Choice router we are routeing flow processing based on response received and number of retires number.