{"id":28920319,"url":"https://github.com/praqma/tracey-broker","last_synced_at":"2025-07-11T10:43:33.330Z","repository":{"id":42417789,"uuid":"60768639","full_name":"Praqma/tracey-broker","owner":"Praqma","description":"Common library for sending and receiving messages","archived":false,"fork":false,"pushed_at":"2018-08-03T11:14:18.000Z","size":202,"stargazers_count":0,"open_issues_count":5,"forks_count":1,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-06-22T04:13:20.985Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Praqma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-09T11:09:11.000Z","updated_at":"2018-08-03T11:14:20.000Z","dependencies_parsed_at":"2022-09-18T00:01:34.417Z","dependency_job_id":null,"html_url":"https://github.com/Praqma/tracey-broker","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/Praqma/tracey-broker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2Ftracey-broker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2Ftracey-broker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2Ftracey-broker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2Ftracey-broker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Praqma","download_url":"https://codeload.github.com/Praqma/tracey-broker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Praqma%2Ftracey-broker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264787446,"owners_count":23663936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-06-22T04:13:21.641Z","updated_at":"2025-07-11T10:43:33.322Z","avatar_url":"https://github.com/Praqma.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nmaintainer: MadsNielsen\n---\n\n[![Build Status](https://api.travis-ci.org/Praqma/tracey-broker.svg?branch=master)](https://travis-ci.org/Praqma/tracey-broker)\n\n# tracey-broker\n\nThe broker module for Tracey project.\nThis module contains abstractions and concrete implementations for the type of middleware we wish to support for messaging.\nThe Broker class holds references to both sender and reciever, two seperate interfaces\n\n![Design Diagram](/docs/images/tracey2.png)\n\n### TraceySender.java\n\n```\n\tpackage net.praqma.tracey.broker;\n\t\n\tpublic interface TraceySender \u003cT extends RoutingInfo\u003e{\n    \tpublic String send(String payload, T data) throws TraceyIOError;\n\t}\n\n```\n\n### TraceyReciver.java\n\n```\n\tpackage net.praqma.tracey.broker;\n\n\tpublic interface TraceyReceiver \u003cT extends RoutingInfo\u003e {\n \t   public String receive(T data) throws TraceyIOError;\n\t}\n```\n\n### RoutingInfo.java\n\n```\npublic interface RoutingInfo {\n}\n```\n\n`RoutingInfo` is an empty interface to have a generic way of providing routing info about connection to send and receive methods.\nIn the case of RabbitMQ RoutingInfo implementation contains the routing key, message header, delivery mode, exchange name and exchange type.\n\n\n### TraceyBroker.java\n\nTracyBroker is an abstract class that contains an implementation of a sender and a receiver. That means for any given broker middleware, we can subclass and add specific implementations.\n\n```\n\tpublic abstract class TraceyBroker\u003cT extends TraceyReceiver, S extends TraceySender\u003e {\n\n\t\tprotected T receiver;\n\t\tprotected S sender;\n\t\t\n\t\tpublic String send(String payload, RoutingInfo data) throws TraceyValidatorError, TraceyIOError {\n\t\t\treturn sender.send(payload, data);\n\t\t}\n\n\t\tpublic String receive(RoutingInfo data) throws TraceyValidatorError, TraceyIOError {\n\t\t\treturn receiver.receive(data);\n\t\t}\n\t\t....\n\t}\n```\n\n## RabbitMQ Implementation. Examples\n\n### Create from config file\n\nFirst create configuration file. See example below\n```\nbroker {\n    rabbitmq {\n    \tconnection {\n        \thost = 'some.host.name'\n        \tport = 4444\n        \tuserName = 'myuser'\n        \tpassword = 's0m3p4ss'\n        \tautomaticRecovery = true\n        }\n        routingInfo {\n        \texchangeName = 'stacie'\n        \texchangeType = 'fanout'\n        \troutingKey = ''\n        \tdeliveryMode = 1\n        \theaders {\n        \t\tsomeKey = 'someValue'\n        \t\tsomeKey1 = 0\n        \t}\n        }\n    }\n}\n```\n\nThen create broker\n\n```\nfinal File configFile = new File(\"path to configuration file\");\nfinal TraceyRabbitMQBrokerImpl broker = new TraceyRabbitMQBrokerImpl(configFile);\nfinal RabbitMQRoutingInfo info = RabbitMQRoutingInfo.buildFromConfigFile(configFile);\n```\n\nNote that filters for receiver is not covered by the configuration file.\nYou will need to set them separately\n\n```\nbroker.getReceiver().setFilters(...)\n```\n\nAnd then send\n\n```\nbroker.getSender().send(\"Hello!\", info);\n```\n\nor receive\n\n```\nbroker.getReceiver().receive(info);\n```\n\nPlease note that you can use environment variable names for user name and password to avoid storing them\nin plain text. Use the following format - %SOMETEXT%, ${SOMETEXT}, $SOMETEXT, $SOMETEXT$. See example below\n\n```\nbroker {\n    rabbitmq {\n    \tconnection {\n        \thost = 'some.host.name'\n        \tport = 4444\n        \tuserName = '${USERNAME}'\n        \tpassword = '${PASSWORD}'\n        \tautomaticRecovery = true\n        }\n    }\n}\n```\n\nAlso, you don't have to specify all fields in the configuration file - if some piece is not provided then\ndefault value will be used. Check RabbitMQDefaults to see them.\nSee example below\n\n```\nbroker {\n    rabbitmq {\n    \tconnection {\n        \thost = 'my.host'\n        \tuserName = '${USERNAME}'\n        \tpassword = '${PASSWORD}'\n        }\n    }\n}\n```\n\n### Using constructors\n\nTBD\n\n## Build, test, contribute\n\n### Building tracey-broker\n\nSimply run `gradlew build`\n\n### Get the latest builds\n\nTracey broker built using [JitPack](https://jitpack.io). See [instructions](https://jitpack.io/#Praqma/tracey-broker) how to add it as dependency\n\n### TODO\n\n- Threading, `.basicConsume(...)` blocks.\n\n\n\n\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraqma%2Ftracey-broker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraqma%2Ftracey-broker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraqma%2Ftracey-broker/lists"}