Skip to content

Commit

Permalink
tweaked with better UI
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyan-manivasagam committed Apr 26, 2024
1 parent 55369cc commit 387dc7a
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 16 deletions.
41 changes: 37 additions & 4 deletions Consumer/index.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
<?php
$filename = "messages.txt";

echo '
<!DOCTYPE html>
<html>
<head>
<!-- Import Google Icon Font -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Import materialize.css -->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
media="screen,projection" />
<!-- Let browser know website is optimized for mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
ul.collection {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li.collection-item {
float: left;
}
li.collection-item a {
display: block;
text-align: center;
padding: 5px 6px;
text-decoration: none;
}
</style>
<title>Message Form</title>
</head>
<body>
<ul class="collection">
<li class="collection-item"><a href="index.php">Send Message</a></li>
<li class="collection-item"><a href="consumer.php">View Messages</a></li>
</ul>
<div class="container">';
echo file_get_contents("messages.txt");


echo file_get_contents($filename);




echo '</div>
Expand Down
49 changes: 41 additions & 8 deletions Producer/index.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,61 @@
<?php

session_start();
echo '
<!DOCTYPE html>
<html>
<head>
<!-- Import Google Icon Font -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Import materialize.css -->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
media="screen,projection" />
<!-- Let browser know website is optimized for mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
ul.collection {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li.collection-item {
float: left;
}
li.collection-item a {
display: block;
text-align: center;
padding: 5px 6px;
text-decoration: none;
}
</style>
<title>Message Form</title>
</head>
<body>
<ul class="collection">
<li class="collection-item"><a href="index.php">Send Message</a></li>
<li class="collection-item"><a href="consumer.php">View Messages</a></li>
</ul>';
if (isset($_SESSION['message'])) {
echo '<div class="alert alert-success" role="alert">
' . $_SESSION['message'] . '</div>';
unset($_SESSION['message']);
}
echo '<div class="container">
<h2>Message Form</h2>
<div class="container">
<h2>Registration Form</h2>
<form action="register.php" method="post">
<form action="send.php" method="post">
<div class="input-field">
<input id="email" type="text" name="email" class="validate">
<label for="email">Email</label>
<label for="email">Message</label>
</div>
<button class="btn waves-effect waves-light" type="submit" name="action">Register
<button class="btn waves-effect waves-light" type="submit" name="action">Send message to kafka / pulsar with kafka protocol
<i class="material-icons right">send</i>
</button>
</form>
Expand Down
4 changes: 2 additions & 2 deletions Producer/register.php → Producer/send.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

session_start();
$jwt = getenv('JWT_TOKEN');
$namespace = getenv('NAMESPACE');
$topicName = $namespace . "/" . getenv('TOPIC_NAME');
Expand All @@ -22,5 +22,5 @@
if (RD_KAFKA_RESP_ERR_NO_ERROR !== $result) {
throw new \RuntimeException('Was unable to flush, messages might be lost!');
}

$_SESSION['message'] = "Message sent to Topic successfully View messages page to see them";
header("location:index.php");
2 changes: 1 addition & 1 deletion k8s/consumer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ spec:
spec:
containers:
- name: consumer
image: karthikeyanmanivasagam/kafka-consumer:1.1
image: karthikeyanmanivasagam/kafka-consumer:1.7
ports:
- containerPort: 9000
2 changes: 1 addition & 1 deletion k8s/producer-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ spec:
spec:
containers:
- name: producer
image: karthikeyanmanivasagam/kafka-producer:1.2
image: karthikeyanmanivasagam/kafka-producer:1.6
ports:
- containerPort: 9000

0 comments on commit 387dc7a

Please sign in to comment.