{"id":22442224,"url":"https://github.com/colinbut/activemq-spring-example","last_synced_at":"2026-05-05T23:33:51.217Z","repository":{"id":69157688,"uuid":"78303145","full_name":"colinbut/activemq-spring-example","owner":"colinbut","description":"ActiveMQ example with Spring ","archived":false,"fork":false,"pushed_at":"2017-02-24T22:06:34.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T10:16:55.525Z","etag":null,"topics":["activemq","activemq-broker-instance","annotations","jms","spring","spring-boot","xml-configuration"],"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/colinbut.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":"2017-01-07T20:53:04.000Z","updated_at":"2022-02-03T09:57:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa1be2a6-ec43-44c2-8094-27282d0d1da1","html_url":"https://github.com/colinbut/activemq-spring-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/colinbut/activemq-spring-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbut%2Factivemq-spring-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbut%2Factivemq-spring-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbut%2Factivemq-spring-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbut%2Factivemq-spring-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinbut","download_url":"https://codeload.github.com/colinbut/activemq-spring-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinbut%2Factivemq-spring-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-broker-instance","annotations","jms","spring","spring-boot","xml-configuration"],"created_at":"2024-12-06T02:18:28.750Z","updated_at":"2026-05-05T23:33:51.200Z","avatar_url":"https://github.com/colinbut.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveMQ - Spring Example\n\nThis project repository demonstrates ways to use ActiveMQ with the Spring framework.\n\nSpring provides JMS abstractions for working with messaging. All the low level JMS implementations by ActiveMQ is hidden away by Spring.\n\nActiveMQ implements JMS.\n\nJust use `JmsTemplate`\n\n### Spring XML Configuration\n\nThis sub project shows how to simply integrate ActiveMQ with Spring. Uses the traditional XML configuration approach.\n\nneed to define an application context file:\n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cbeans xmlns=\"http://www.springframework.org/schema/beans\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n        http://www.springframework.org/schema/beans/spring-beans.xsd\"\u003e\n\n    \u003cbean id=\"amqConnectionFactory\" class=\"org.apache.activemq.ActiveMQConnectionFactory\"\u003e\n        \u003cconstructor-arg index=\"0\" value=\"tcp://localhost:61616\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"connectionFactory\" class=\"org.springframework.jms.connection.CachingConnectionFactory\"\u003e\n        \u003cconstructor-arg ref=\"amqConnectionFactory\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"queueDestination\" class=\"org.apache.activemq.command.ActiveMQQueue\"\u003e\n        \u003cconstructor-arg index=\"0\" value=\"queue_name\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"jmsTemplate\" class=\"org.springframework.jms.core.JmsTemplate\"\u003e\n        \u003cproperty name=\"connectionFactory\" ref=\"connectionFactory\"/\u003e\n        \u003cproperty name=\"defaultDestination\" ref=\"queueDestination\"/\u003e\n    \u003c/bean\u003e\n\n    \u003c!-- my bean that sends jms messages to activemq --\u003e\n    \u003cbean id=\"messageSender\" class=\"com.mycompany.activemq.MessageSender\"\u003e\n        \u003cconstructor-arg index=\"0\" ref=\"jmsTemplate\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"messageReceiver\" class=\"com.mycompany.activemq.MessageReceiver\"/\u003e\n\n    \u003cbean class=\"org.springframework.jms.listener.SimpleMessageListenerContainer\"\u003e\n        \u003cproperty name=\"connectionFactory\" ref=\"connectionFactory\"/\u003e\n        \u003cproperty name=\"destinationName\" value=\"activemq_spring_xml\"/\u003e\n        \u003cproperty name=\"messageListener\" ref=\"messageReceiver\"/\u003e\n    \u003c/bean\u003e\n\n\u003c/beans\u003e\n```\n\nneed to start up the ActiveMQ broker instance.\n\n### Spring XML Configuration with Annotations (component scanning)\n\nalso need to define a application context file.\n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cbeans xmlns=\"http://www.springframework.org/schema/beans\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xmlns:context=\"http://www.springframework.org/schema/context\"\n       xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n        http://www.springframework.org/schema/beans/spring-beans.xsd\n        http://www.springframework.org/schema/context\n        http://www.springframework.org/schema/context/spring-context.xsd\"\u003e\n\n    \u003c!-- component scanning for beans --\u003e\n    \u003ccontext:component-scan base-package=\"com.mycompany.activemq\"/\u003e\n\n    \u003cbean id=\"amqConnectionFactory\" class=\"org.apache.activemq.ActiveMQConnectionFactory\"\u003e\n        \u003cconstructor-arg index=\"0\" value=\"tcp://localhost:61616\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"connectionFactory\" class=\"org.springframework.jms.connection.CachingConnectionFactory\"\u003e\n        \u003cconstructor-arg ref=\"amqConnectionFactory\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"queueDestination\" class=\"org.apache.activemq.command.ActiveMQQueue\"\u003e\n        \u003cconstructor-arg index=\"0\" value=\"activemq_spring_xml_annotations\"/\u003e\n    \u003c/bean\u003e\n\n    \u003cbean id=\"jmsTemplate\" class=\"org.springframework.jms.core.JmsTemplate\"\u003e\n        \u003cproperty name=\"connectionFactory\" ref=\"connectionFactory\"/\u003e\n        \u003cproperty name=\"defaultDestination\" ref=\"queueDestination\"/\u003e\n    \u003c/bean\u003e\n\n\n    \u003cbean class=\"org.springframework.jms.listener.SimpleMessageListenerContainer\"\u003e\n        \u003cproperty name=\"connectionFactory\" ref=\"connectionFactory\"/\u003e\n        \u003cproperty name=\"destinationName\" value=\"activemq_spring_xml_annotations\"/\u003e\n        \u003cproperty name=\"messageListener\" ref=\"messageReceiver\"/\u003e\n    \u003c/bean\u003e\n\n\n\u003c/beans\u003e\n```\n\nAnd simply annotate the beans:\n\n```\n@Service\npublic class MessageSender {\n\n    @Autowired\n    private JmsTemplate jmsTemplate;\n```\n\nneed to start up the ActiveMQ broker instance.\n\n### Spring Boot - Spring JMS - Java Configuration\n\nThis sub project shows Bootstrapping spring application that uses ActiveMQ with Spring Boot.\n\nSpring Boot starts up an embedded ActiveMQ broker instance.\n\nNo XML configuration required.\n\nJust using Spring Java Configuration. All configuration is done using Java code. Very simple and clean.\n\n```\n@SpringBootApplication\n@EnableJms\npublic class Application {\n\n    @Bean\n    public JmsListenerContainerFactory\u003c?\u003e myFactory(ConnectionFactory connectionFactory,\n                                                    DefaultJmsListenerContainerFactoryConfigurer defaultJmsListenerContainerFactoryConfigurer) {\n        DefaultJmsListenerContainerFactory defaultJmsListenerContainerFactory = new DefaultJmsListenerContainerFactory();\n        defaultJmsListenerContainerFactoryConfigurer.configure(defaultJmsListenerContainerFactory, connectionFactory);\n        return defaultJmsListenerContainerFactory;\n    }\n\n    @Bean\n    public MessageConverter jacksonJmsMessageConverter() {\n        //....\n    }\n\n```\n\nThe consumer:\n\n```\n@Component\npublic class Receiver {\n\n    @JmsListener(destination = \"destination\", containerFactory = \"myFactory\")\n    public void receiveMessage(Email email) {\n        //....\n    }\n}\n```\n\nFor Prodcuer:\n\njust simply get the `JmsTemplate` and use one of its send methods\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinbut%2Factivemq-spring-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinbut%2Factivemq-spring-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinbut%2Factivemq-spring-example/lists"}