{"id":19815582,"url":"https://github.com/libgraviton/messaging-java","last_synced_at":"2025-05-01T10:31:39.045Z","repository":{"id":57721012,"uuid":"81541686","full_name":"libgraviton/messaging-java","owner":"libgraviton","description":"Message Queue Integration Library for Java","archived":true,"fork":false,"pushed_at":"2020-03-23T08:12:26.000Z","size":118,"stargazers_count":1,"open_issues_count":10,"forks_count":1,"subscribers_count":14,"default_branch":"develop","last_synced_at":"2025-02-28T19:28:29.013Z","etag":null,"topics":["java","jms","messaging","rabbitmq"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libgraviton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T07:59:20.000Z","updated_at":"2024-09-13T06:12:52.000Z","dependencies_parsed_at":"2022-09-04T16:20:53.927Z","dependency_job_id":null,"html_url":"https://github.com/libgraviton/messaging-java","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgraviton%2Fmessaging-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgraviton%2Fmessaging-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgraviton%2Fmessaging-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libgraviton%2Fmessaging-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libgraviton","download_url":"https://codeload.github.com/libgraviton/messaging-java/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251859959,"owners_count":21655648,"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":["java","jms","messaging","rabbitmq"],"created_at":"2024-11-12T10:06:24.823Z","updated_at":"2025-05-01T10:31:38.676Z","avatar_url":"https://github.com/libgraviton.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# messaging-java\n[![Build Status](https://travis-ci.org/libgraviton/messaging-java.svg?branch=develop)](https://travis-ci.org/libgraviton/messaging-java) [![Coverage Status](https://coveralls.io/repos/libgraviton/messaging-java/badge.svg?branch=develop\u0026service=github)](https://coveralls.io/github/libgraviton/messaging-java?branch=develop) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.libgraviton/messaging/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.libgraviton/messaging) [![javadoc.io](https://javadocio-badges.herokuapp.com/com.github.libgraviton/messaging/badge.svg)](https://javadocio-badges.herokuapp.com/com.github.libgraviton/messaging) \n\n\nMessage Queue Integration Library for Java\n\n## Supported Message Brokers\n\n* RabbitMQ\n* JMS based Message Brokers\n\n\n## Using the library\n\n### Setup\n\nIn order to use the library, include the following in the `pom.xml` of your project:\n\n```xml\n\u003cdependencies\u003e\n\t\u003cdependency\u003e\n\t\t\u003cgroupId\u003ecom.github.libgraviton\u003c/groupId\u003e\n\t\t\u003cartifactId\u003emessaging\u003c/artifactId\u003e\n\t\t\u003cversion\u003eLATEST\u003c/version\u003e\n\t\u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nMake sure that `version` points to the newest release on maven central (see badge above).\n\n### Publish Messages\n\nTo publish messages you need an instance of `QueueConnection`, which represents the connection to the Message Queue.\nOnce you have a `QueueConnection`, you can simply do the following to publish a message:\n```java\nQueueConnection connection = new RabbitMqConnection.Builder().queueName(\"your-queue\").build();\n\ntry {\n    connection.publish(\"the message\");\n} catch (CannotPublishMessage e) {\n    // Message publishment failed for some reason.\n    fail(String.format(\"An exception occurred: '%s'\", e.getClass().getName()));\n}\n```\n\n### Consume Messages\nTo consume messages you need an instance of `QueueConnection`, which represents the connection to the Message Queue.\n\nOnce you have a `QueueConnection`, you can simply do the following to consume a message:\n```java\nConsumer consumer = new Consumer() {\n\n    @Override\n    public void consume(String messageId, String message) throws CannotConsumeMessage {\n        System.out.println(String.format(\"Received message with id '%s': '%s'\", messageId, message));\n    }\n\n};\n\nQueueConnection connection = new RabbitMqConnection.Builder().queueName(\"your-queue\").build();\n\ntry {\n    connection.consume(consumer);\n} catch (CannotRegisterConsumer e) {\n    // Consumer registration failed for some reason.\n    fail(String.format(\"An exception occurred: '%s'\", e.getClass().getName()));\n}\n```\n\nIn this case, each message gets automatically acknowledged. If you want to handle message acknowledgment yourself, you need to register an `AcknowledgingConsumer`:\n```java\nConsumer consumer = new AcknowledgingConsumer() {\n\n    private MessageAcknowledger acknowledger;\n\n    @Override\n    public void setAcknowledger(MessageAcknowledger acknowledger) {\n        this.acknowledger = acknowledger;\n    }\n\n    @Override\n    public void consume(String messageId, String message) throws CannotConsumeMessage {\n        System.out.println(String.format(\"Received message with id '%s': '%s'\", messageId, message));\n        try {\n            acknowledger.acknowledge(messageId);\n        } catch (CannotAcknowledgeMessage e) {\n            // Message Acknowledgment failed for some reason\n            throw new CannotConsumeMessage(messageId, message, e);\n        }\n    }\n\n};\n\nQueueConnection connection = new RabbitMqConnection.Builder().queueName(\"your-queue\").build();\n\ntry {\n    connection.consume(consumer);\n} catch (CannotRegisterConsumer e) {\n    // Consumer registration failed for some reason.\n    fail(String.format(\"An exception occurred: '%s'\", e.getClass().getName()));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgraviton%2Fmessaging-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibgraviton%2Fmessaging-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibgraviton%2Fmessaging-java/lists"}