The first Azure function is designed to handle incoming messages containing a city name. Upon receiving a message, the function performs the following tasks:
-
Message Validation:
- Reads the incoming message and validates the data.
- Checks if a city name is present.
- Validates that the city name is alphanumeric.
- Ensures that the city name does not exceed 100 characters.
-
Weather API Integration:
- If the data is valid, calls the weather forecast API using the city from the message.
- Processes the API response.
-
Postman Echo API:
- If a valid response is received from the Weather API, the results are sent to the Postman echo API.
-
Error Handling:
- If any validation fails or other errors occur, an error response is sent to the response queue.
-
Success Handling:
- If the entire process completes without errors, a success message is sent to the response queue.
The second Azure function is responsible for handling messages containing success or failure responses from Function One. The tasks performed by this function include:
- Response Logging:
- Receives messages with success or failure responses from Function One.
- Logs the responses using a logger.
This two-function solution ensures efficient handling of city weather data, validation, and logging of responses for further analysis and monitoring.