Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mob programming 2021 11 12 #2

Draft
wants to merge 4 commits into
base: feature/achieve-exactly-once-processing
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions golang/.env.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
KAFKA_URL=kafka:9092
PULSAR_URL=pulsar://pulsar:6650
MYSQL_URL=root:root@(mariadb:3306)/reviews
MESSAGING_PROTOCOL=protobuf
EVENT_STREAM_TYPE=pulsar
50 changes: 16 additions & 34 deletions golang/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ services:
networks:
ppro:

event-stream-golang-review-created-consumer:
container_name: pp_event_stream_golang_review_created_consumer
build: ./
env_file:
- ./.env
- ./.env.dist
entrypoint: /bin/event-stream-golang consume-review-created
working_dir: /srv
volumes:
- ./:/srv:cached
deploy:
restart_policy:
condition: on-failure
networks:
ppro:
# event-stream-golang-review-created-consumer:
# container_name: pp_event_stream_golang_review_created_consumer
# build: ./
# env_file:
# - ./.env
# - ./.env.dist
# entrypoint: /bin/event-stream-golang consume-review-created
# working_dir: /srv
# volumes:
# - ./:/srv:cached
# deploy:
# restart_policy:
# condition: on-failure
# networks:
# ppro:

zookeeper:
image: docker.io/bitnami/zookeeper:3.7
Expand All @@ -48,6 +48,7 @@ services:
condition: on-failure
networks:
ppro:

kafka:
image: docker.io/bitnami/kafka:3
ports:
Expand All @@ -65,25 +66,6 @@ services:
networks:
ppro:

pulsar:
image: apachepulsar/pulsar:2.8.1
ports:
- "8081:8081"
- "6650:6650"
environment:
- BOOKIE_MEM=" -Xms512m -Xmx512m -XX:MaxDirectMemorySize=1g"
command: >
/bin/bash -c
"bin/apply-config-from-env.py /conf/pulsar.conf
&& exec bin/pulsar standalone --advertised-address pulsar"
volumes:
- ./conf:/conf:cached
networks:
ppro:
deploy:
restart_policy:
condition: on-failure

mariadb:
image: mariadb:10.6.4
restart: on-failure
Expand Down
6 changes: 2 additions & 4 deletions golang/internal/cmd/consume_review_created_event.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"fmt"

"github.com/urfave/cli"
)

Expand All @@ -15,7 +13,7 @@ func consumeReviewCreatedEvent(baseFlags []cli.Flag) cli.Command {
}

func consumeReviewCreated(c *cli.Context) error {
serviceLocator := newServiceLocatorFromCliContext(c)
/*serviceLocator := newServiceLocatorFromCliContext(c)

migrate := Migrate{db: serviceLocator.MysqlDB()}
migrate.Migrate()
Expand All @@ -25,7 +23,7 @@ func consumeReviewCreated(c *cli.Context) error {
err := consumer.Consume()
if err != nil {
fmt.Println(err)
}
}*/

return nil
}
15 changes: 0 additions & 15 deletions golang/internal/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,10 @@ func GetApp(version string) *cli.App {
Name: "event_stream-url",
EnvVar: "KAFKA_URL",
},
cli.StringFlag{
Name: "pulsar-url",
EnvVar: "PULSAR_URL",
},
cli.StringFlag{
Name: "mysql-url",
EnvVar: "MYSQL_URL",
},
cli.StringFlag{
Name: "messaging-protocol",
EnvVar: "MESSAGING_PROTOCOL",
},
cli.StringFlag{
Name: "event-stream-type",
EnvVar: "EVENT_STREAM_TYPE",
},
}

app.Commands = []cli.Command{
Expand All @@ -48,9 +36,6 @@ func GetApp(version string) *cli.App {
func newServiceLocatorFromCliContext(c *cli.Context) *serviceLocator {
return newServiceLocator(
c.String("kafka-url"),
c.String("pulsar-url"),
c.String("mysql-url"),
c.String("event-stream-type"),
c.String("messaging-protocol"),
)
}
15 changes: 0 additions & 15 deletions golang/internal/cmd/migrate_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ func (m *Migrate) Migrate() {
comment TEXT DEFAULT '',
rating INT DEFAULT 0,
PRIMARY KEY (uuid)
);`,
)

m.db.MustExec(`CREATE TABLE IF NOT EXISTS review_events_outbox (
id BIGINT NOT NULL AUTO_INCREMENT,
uuid VARCHAR(256) NOT NULL,
aggregate_id VARCHAR(256) NOT NULL,
name VARCHAR(256) NOT NULL,
payload TEXT NOT NULL,
version VARCHAR(256) NOT NULL,
status INT NOT NULL,
message_counter_by_aggregate INT NOT NULL,
PRIMARY KEY (id),
UNIQUE (uuid),
UNIQUE (aggregate_id, message_counter_by_aggregate)
);`,
)
}
Loading