{"id":18475365,"url":"https://github.com/alessandroargentieri/java-messaging","last_synced_at":"2026-01-22T11:33:44.698Z","repository":{"id":121662249,"uuid":"451440956","full_name":"alessandroargentieri/java-messaging","owner":"alessandroargentieri","description":"Java async messaging using AWS SNS-SQS, RabbitMQ, ActiveMQ, Kafka and API notifications","archived":false,"fork":false,"pushed_at":"2022-06-15T07:49:37.000Z","size":158,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-16T19:42:08.334Z","etag":null,"topics":["activemq","activemq-message-broker","amazon-web-services","aws","kafka","kafka-consumer","kafka-producer","kafka-streams","localstack","rabbitmq","rabbitmq-client","sns","spring","spring-boot","springboot","sqs"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alessandroargentieri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-24T11:42:07.000Z","updated_at":"2024-10-26T16:10:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"d95abe9d-5925-4bef-9cca-a6a57753beb2","html_url":"https://github.com/alessandroargentieri/java-messaging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alessandroargentieri/java-messaging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessandroargentieri%2Fjava-messaging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessandroargentieri%2Fjava-messaging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessandroargentieri%2Fjava-messaging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessandroargentieri%2Fjava-messaging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessandroargentieri","download_url":"https://codeload.github.com/alessandroargentieri/java-messaging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessandroargentieri%2Fjava-messaging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28662131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activemq","activemq-message-broker","amazon-web-services","aws","kafka","kafka-consumer","kafka-producer","kafka-streams","localstack","rabbitmq","rabbitmq-client","sns","spring","spring-boot","springboot","sqs"],"created_at":"2024-11-06T10:34:16.218Z","updated_at":"2026-01-22T11:33:44.679Z","avatar_url":"https://github.com/alessandroargentieri.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java Event Driven Application\n\nExample application on how to use Java in a event driver fashion.\n\n## Summary\n\nThis codebase contains some simple examples how of to engage an event driven architecture in Java.\nThe `EventProducer\u003cT\u003e` interface provide a way to define a generic notification producer.\n\nThe implementation used in this codebase are three:\n- `EndpointEventProducer`: though which the notification is sent to a REST endpoint;\n- `SnsEventProducer`: through which the event is notified on `AWS SNS` service, by creating a new `topic` for that specific event;\n- `RabbitMqEventProducer`: though which the event is notified on `RabbitMQ` by creating a new `exchange`.\n- `ActiveMqEventProducer`: though which the event is notified on `Apache ActiveMQ` by creating a new `topic`.\n- `KafkaEventProducer`: though which the event is notified on `Apache Kafka` by creating a new `topic`.\n\nThe codebase provides a way to consume these three events with their respective consumer:\n- an endpoint in the `RestController` class which consumes the events sent via `EndpointEventProducer`;\n- a `SqsConsumer` class which creates an `AWS SQS queue` and automatically suscribes it to the given `AWS SNS topic`;\n- a `RabbitMqConsumer` class which creates a `queue` and registers it to the given `exchange` to consume the messages.\n- an `ActiveMqConsumer` class which subscribe directly to the `ActiveMqEventProducer` `topic` to consume the messages.\n- a `KafkaEventConsumer` class which reads the records coming from the `KafkaEventProducer` producer `topic`.\n\n## Run locally\n\nTo start the application locally you must have `localstack` (which emulates AWS services locally) and `rabitMQ` started locally in Docker containers.\nTo automatize this phase an `init` script has been provided:\n\n```bash\nyour/project/folder/ $ ./init.sh\n```\nThen you can start your application though your IDE or by exporting the jar artifact:\n```bash\nyour/project/folder/ $ mvn clean install\nyour/project/folder/ $ java -jar ./target/notificationdemo-0.0.1.jar\n```\nThe process will start an HTTP server on port 8080, so pay attention to let it free before starting the process.\n\nTo stop the processes you can take advantage of the `quit.sh` script:\n\n```bash\nyour/project/folder/ $ ./quit.sh\n```\n\n## Insights on Localstack in docker\n\nLocalstack is a useful way to have your AWS services running locally without having to link your app to your AWS cloud account.\n\n### Localstack Cheatsheet\n```bash\n# Run docker image of localstack\ndocker run -it --rm -d -p 8081:8081 -p 4566-4599:4566-4599 --name lk localstack/localstack\n\n# Health check\ncurl http://localhost:4566/health | jq\n{\n  \"features\": {\n    \"initScripts\": \"initialized\"\n  },\n  \"services\": {\n    \"acm\": \"available\",\n    \"apigateway\": \"available\",\n    \"cloudformation\": \"available\",\n    \"cloudwatch\": \"available\",\n    \"config\": \"available\",\n    \"dynamodb\": \"available\",\n    \"dynamodbstreams\": \"available\",\n    \"ec2\": \"available\",\n    \"es\": \"available\",\n    \"events\": \"available\",\n    \"firehose\": \"available\",\n    \"iam\": \"available\",\n    \"kinesis\": \"available\",\n    \"kms\": \"available\",\n    \"lambda\": \"available\",\n    \"logs\": \"available\",\n    \"opensearch\": \"available\",\n    \"redshift\": \"available\",\n    \"resource-groups\": \"available\",\n    \"resourcegroupstaggingapi\": \"available\",\n    \"route53\": \"available\",\n    \"route53resolver\": \"available\",\n    \"s3\": \"running\",\n    \"secretsmanager\": \"available\",\n    \"ses\": \"available\",\n    \"sns\": \"running\",\n    \"sqs\": \"running\",\n    \"ssm\": \"available\",\n    \"stepfunctions\": \"available\",\n    \"sts\": \"available\",\n    \"support\": \"available\",\n    \"swf\": \"available\"\n  },\n  \"version\": \"0.13.3\"\n}\n\n# s3 service\n\n# create s3 bucket\naws --endpoint-url=http://localhost:4566 s3 mb s3://mybucket\n# list s3 files\naws --endpoint-url=http://localhost:4566 s3 ls\n# upload file into s3 bucket\necho 'hello world!' \u003e text-test.txt\naws --endpoint-url=http://localhost:4566 s3 cp text-test.txt s3://mybucket\n# list s3 files\naws --endpoint-url=http://localhost:4566 s3 ls s3://mybucket\n\n# SNS and SQS\n\n# create topic\naws --endpoint-url=http://localhost:4566 sns create-topic --name mytopic\n    {\"TopicArn\": \"arn:aws:sns:eu-west-1:000000000000:mytopic\"}\n# create queue\naws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name myqueue001\n    {\"QueueUrl\": \"http://localhost:4566/000000000000/myqueue001\"}\n# subscribe queue to topic\naws --endpoint-url=http://localhost:4566 sns subscribe --topic-arn arn:aws:sns:eu-west-1:000000000000:mytopic --protocol sqs --notification-endpoint http://localhost:4566/queue/myqueue001\n    {\"SubscriptionArn\": \"arn:aws:sns:eu-west-1:000000000000:mytopic:20ed1612-26cb-4297-882d-e33158ab6130\"}\n\n# list topics\naws --endpoint-url=http://localhost:4566 sns list-topics    \n# list queues\naws --endpoint-url=http://localhost:4566 sqs list-queues\n# list subscriptions\naws --endpoint-url=http://localhost:4566 sns list-subscriptions\n\n# send notifications to topic\naws --endpoint-url=http://localhost:4566 sns publish --topic-arn arn:aws:sns:eu-west-1:000000000000:mytopic --message \"Hi\"\naws --endpoint-url=http://localhost:4566 sns publish --topic-arn arn:aws:sns:eu-west-1:000000000000:mytopic --message file://file.json\n\n# read message on queue\naws --endpoint-url=http://localhost:4566 sqs receive-message --queue-url http://localhost:4566/000000000000/myqueue001\n\n### send message on queue\naws --endpoint-url=http://localhost:4566 sqs send-message --queue-url http://localhost:4566/000000000000/myqueue001 --message-body 'Welcome to SQS queue myqueue001'\n\n### read message from queue\naws --endpoint-url=http://localhost:4566 sqs receive-message --queue-url http://localhost:4566/000000000000/myqueue001\n\n### delete queue\naws --endpoint-url=http://localhost:4566 sqs delete-queue --queue-url http://localhost:4566/000000000000/myqueue001\n\n# AWS Secrets Manager\n\n# list all secrets\naws --endpoint-url=http://localhost:4566 secretsmanager list-secrets\n\n# create new secret\naws --endpoint-url=http://localhost:4566 secretsmanager create-secret --name jason \\\n    --description \"This is the password for dev-db admin user1\" \\\n    --secret-string \"MySecretSecureString$123\" \\\n    --tags \"Key=Environment,Value=Development\"\n\n# add tags to an existing secret\naws --endpoint-url=http://localhost:4566 secretsmanager tag-resource --secret-id jason \\\n  --tags '[{\"Key\": \"Name\", \"Value\": \"Jason\"}, {\"Key\": \"Role\", \"Value\": \"Admin\"}]'\n\n# untag a specific secret\naws --endpoint-url=http://localhost:4566 secretsmanager untag-resource --secret-id jason \\\n--tag-keys '[ \"Environment\", \"Name\"]'\n\n# get the secret value given its name\naws --endpoint-url=http://localhost:4566 secretsmanager get-secret-value --secret-id jason\n\n# describe a secret given its name\naws --endpoint-url=http://localhost:4566 secretsmanager describe-secret --secret-id jason\n\n# delete a secret by its name (you can recover it within 30 days)\naws --endpoint-url=http://localhost:4566 secretsmanager delete-secret --secret-id jason\n\n# delete a secret by its name specifying the recovery window\naws --endpoint-url=http://localhost:4566 secretsmanager delete-secret --secret-id jason --recovery-window-in-days 21\n\n# recover a deleted secret given its name\naws --endpoint-url=http://localhost:4566 secretsmanager restore-secret --secret-id jason\n\n# update a secret description by its name\naws --endpoint-url=http://localhost:4566 secretsmanager update-secret --secret-id jason \\\n    --description \"This is the password for dev-db admin user\"\n\n# update a secret value by its name\naws --endpoint-url=http://localhost:4566 secretsmanager update-secret --secret-id jason \\\n    --secret-string \"NewlyUpdatedSecret#\"\n\n# list of all temporal versions of a given secret\naws --endpoint-url=http://localhost:4566 secretsmanager list-secret-version-ids --secret-id jason\n\n# get a secret value given its name and a specific temporal version\naws --endpoint-url=http://localhost:4566 secretsmanager get-secret-value --secret-id jason --version-stage AWSPREVIOUS\n\n# get a secret value given its name and a specific version-id\naws --endpoint-url=http://localhost:4566 secretsmanager get-secret-value --secret-id jason --version-id 22222222-8888-51cc-d55e-jk222222222f\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandroargentieri%2Fjava-messaging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessandroargentieri%2Fjava-messaging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessandroargentieri%2Fjava-messaging/lists"}