{"id":15043415,"url":"https://github.com/combinedmq/combinedmq-spring","last_synced_at":"2026-01-07T06:05:52.245Z","repository":{"id":35146918,"uuid":"157313433","full_name":"combinedmq/combinedmq-spring","owner":"combinedmq","description":"combinedmq的spring支持","archived":false,"fork":false,"pushed_at":"2024-02-02T21:55:30.000Z","size":48,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-01T16:48:25.720Z","etag":null,"topics":["mq","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/combinedmq.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-13T03:15:27.000Z","updated_at":"2019-06-07T06:25:01.000Z","dependencies_parsed_at":"2024-09-25T01:59:07.688Z","dependency_job_id":null,"html_url":"https://github.com/combinedmq/combinedmq-spring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinedmq%2Fcombinedmq-spring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinedmq%2Fcombinedmq-spring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinedmq%2Fcombinedmq-spring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/combinedmq%2Fcombinedmq-spring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/combinedmq","download_url":"https://codeload.github.com/combinedmq/combinedmq-spring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245841760,"owners_count":20681196,"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":["mq","spring"],"created_at":"2024-09-24T20:48:59.349Z","updated_at":"2026-01-07T06:05:52.238Z","avatar_url":"https://github.com/combinedmq.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"CombinedMq Spring\n========================\n[![Build Status](https://travis-ci.com/combinedmq/combinedmq-spring.svg?branch=master)](https://travis-ci.com/combinedmq/combinedmq-spring)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.combinedmq/combinedmq-spring.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.combinedmq%22%20AND%20a:%22combinedmq-spring%22)\n\nCombinedMq Spring可以帮助您将CombinedMq集成到Spring中，通过spring schema配置的方式，能够非常方便的完成集成工作。\n\n### 概述\n\nschema配置主要有三个元素：\n1. queue - 定义一个队列，并关联一个接口\n2. producer - 队列接口的代理，用于发送消息\n3. consumer - 引用一个队列接口的实现，用于接收消息\n## 使用步骤\n### Step 1: Maven依赖\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.combinedmq\u003c/groupId\u003e\n  \u003cartifactId\u003ecombinedmq-spring\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n### Step 2: 创建一个接口\n该接口的所有方法返回类型都只能是void类型:\n```java\npublic interface GreetingService {\n    void sayHi(String name);\n}\n```\n### Step 3: Spring Schema配置 - producer\n在applicationContext.xml中加入CombinedMq的schema内容\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cbeans ...\n       xmlns:combinedmq=\"http://www.github.com/schema/combinedmq\"\n\n       xsi:schemaLocation=\"...\n\t\thttp://www.github.com/schema/combinedmq\n        http://www.github.com/schema/combinedmq/combinedmq-spring.xsd\"\u003e\n\n    \u003ccombinedmq:queue id=\"greetingServiceQueue\" name=\"x.y.z\" type=\"point_to_point\"\n                      interface=\"com.github.combinedmq.spring.service.GreetingService\"/\u003e\n\n    \u003ccombinedmq:producer id=\"greetingServiceProducer\" queue-ref=\"greetingServiceQueue\"/\u003e\n\n\u003c/beans\u003e\n```\n可以通过@Autowired注解得到一个producer代理:\n```java\n@Service\npublic class ProducerTest {\n    @Autowired\n    private GreetingService greetingService;\n\n    public void sayHi(String name) {\n        greetingService.sayHi(name);\n    }\n}\n```\n### Step 4: Spring Schema配置 - consumer\n在applicationContext.xml中加入CombinedMq的schema内容\n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cbeans ...\n       xmlns:combinedmq=\"http://www.github.com/schema/combinedmq\"\n\n       xsi:schemaLocation=\"...\n\t\thttp://www.github.com/schema/combinedmq\n        http://www.github.com/schema/combinedmq/combinedmq-spring.xsd\"\u003e\n\n    \u003cbean id=\"greetingService\" class=\"com.github.combinedmq.spring.service.GreetingServiceImpl\"/\u003e\n\n    \u003ccombinedmq:queue id=\"greetingServiceQueue\" name=\"x.y.z\" type=\"point_to_point\"\n                      interface=\"com.github.combinedmq.spring.service.GreetingService\"/\u003e\n    \u003ccombinedmq:consumer queue-ref=\"greetingServiceQueue\" implement-ref=\"greetingService\"/\u003e\n\n\u003c/beans\u003e\n```\n### Step 5: 连接相关的配置文件 - combinedmq.yml\n在资源根目录下添加combinedmq.yml文件，如果您使用rabbitmq，可以在yml文件中加入下面内容：\n \n```yaml\nrabbitmq:\n  host: 10.1.7.22\n  port: 5672\n  username: xiaoyu\n  password: xiaoyu\n  virtualHost: /\n  consumerListener:\n    concurrency: 5 #消费者数量\n  producerPool: #连接池配置，连接池只是针对生产者有效\n    maxTotal: 100\n    maxIdle: 20\n    minIdle: 10\n    maxWaitMillis: 30000\n    minEvictableIdleTimeMillis: 60000\n    timeBetweenEvictionRunsMillis: 30000\n    testOnBorrow: false\n    testOnReturn: false\n    testWhileIdle: true\n#consumerListener和producerPool可以不同时存在\n```\nactivemq、kafka等其他配置可以查看此[配置文件](https://github.com/combinedmq/combinedmq/blob/master/src/test/resources/combinedmq.yml)。\n（在集成到spring中时，combinedmq.yml文件中只能使用rabbitmq、activemq、kafka其中一种）","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinedmq%2Fcombinedmq-spring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcombinedmq%2Fcombinedmq-spring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcombinedmq%2Fcombinedmq-spring/lists"}