1.Setup of the Kafka cluster, including topic management. (20%).
2.Implementation of the client and services in the Ballerina language. (70%)
3.Quality of design and implementation. (10%)
1.Setup of the Kafka cluster, including topic management. (20%).
ANSWER.
We will set up kafka in cluster mode for high availability of the Kafka service.
These are the steps you must take to build the Kafka cluster:
i)First we have to download download Kafka.
ii)Install Java(java contains the java jdk)
iv)We hae to create a folder with appropriate permissions for Kafka logs
v)Create a folder with appropriate permissions for Zookeeper
vi)Specify an ID for the Zookeeper servers to reach quorum
vii)Modify the Kafka configuration file to reflect the appropriate settings
viii)Modify the Zookeeper configuration file to reflect the appropriate settings
ix)In order for Zookeeper to run without manual intervention, create it as a service
x)We need kafaka to run run without manual intervention, so we just create it as a service.
xii)Finally, In order to test that the cluster is working properly, we create a topic.
2.Implementation of the client and services in the Ballerina language. (70%)
ANSWER.
How to implement client in Ballerina programming language
client objects are special kind of objects in Ballerina programming language,
that contain remote methods in addition to regualr methods. It is created by applying
new to the client class.
Remote methods are used to interact with a remote service and their method calls use
the -> syntax which enables sequence diagram view.
EXAMPLE
import ballerina/http;
import ballerina/io;
public function main() returns error? {
#Here we create a client object
http:Client myClient = check new ("just_a_https_link");
http:Response myrespone =
check myClient >get("here_we have_the_directory");
io:println(myrespone .statusCode);
}
How to implement services in Ballerina programming language
A service represents a collection of remotely accessible methods
attached to a particular listener. In oder to create a service in Ballerina,
we use a service declaration. is the one used
for creating services in Ballerina. It is possible to combine a service declation with alister decaltion.
The type of the listener determines required type of remote methods.
EXAMPLE
import ballerina/io;
import ballerina/udp;
service on new udp:Listener(8080) {
remote function mydatagram(readonly & udp:mydatagram dg) {
io:println("bytes received: ", dg.data.length());
}
}
3.Quality of design and implementation. (10%)
ANSWER.
The quality design and implementation of ballerina programming
language has the following advantages:
i)The quality design of Ballerina enables it to be used by everyone,
even if you have minimal knowledge in programming.
ii)Ballerina is a flexible language because it allows for integrations
using sequence diagrams as a basis.
iii) The design used in Ballerina programming language is Secure thus Codes
produced with this programming language resist
the most common security vulnerabilities e.g. unauthorized access.
Comments
Leave a comment