Java Code Examples for org.springframework.jms.listener.DefaultMessageListenerContainer#destroy()
The following examples show how to use
org.springframework.jms.listener.DefaultMessageListenerContainer#destroy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SolaceController.java From solace-samples-cloudfoundry-java with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/subscription/{subscriptionName}", method = RequestMethod.DELETE) public ResponseEntity<String> deleteSubscription(@PathVariable("subscriptionName") String subscriptionTopic) { logger.info("Deleting a subscription to topic: " + subscriptionTopic); if ( !this.listenerContainersMap.containsKey(subscriptionTopic) ) { // Not subscribed logger.error("Not subscribed to topic " + subscriptionTopic); return new ResponseEntity<>("{'description': 'Was not subscribed'}", HttpStatus.BAD_REQUEST); } try { DefaultMessageListenerContainer listenercontainer = this.listenerContainersMap.get(subscriptionTopic); listenercontainer.stop(); listenercontainer.destroy(); this.listenerContainersMap.remove(subscriptionTopic); } catch (Exception e) { logger.error("Service Creation failed.", e); return new ResponseEntity<>("{'description': '" + e.getMessage() + "'}", HttpStatus.BAD_REQUEST); } logger.info("Finished Deleting a subscription to topic: " + subscriptionTopic); return new ResponseEntity<>("{}", HttpStatus.OK); }
Example 2
Source File: SolaceController.java From solace-samples-cloudfoundry-java with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/subscription/{subscriptionName}", method = RequestMethod.DELETE) public ResponseEntity<String> deleteSubscription(@PathVariable("subscriptionName") String subscriptionTopic) { logger.info("Deleting a subscription to topic: " + subscriptionTopic); if ( !this.listenerContainersMap.containsKey(subscriptionTopic) ) { // Not subscribed logger.error("Not subscribed to topic " + subscriptionTopic); return new ResponseEntity<>("{'description': 'Was not subscribed'}", HttpStatus.BAD_REQUEST); } try { DefaultMessageListenerContainer listenercontainer = this.listenerContainersMap.get(subscriptionTopic); listenercontainer.stop(); listenercontainer.destroy(); this.listenerContainersMap.remove(subscriptionTopic); } catch (Exception e) { logger.error("Service Creation failed.", e); return new ResponseEntity<>("{'description': '" + e.getMessage() + "'}", HttpStatus.BAD_REQUEST); } logger.info("Finished Deleting a subscription to topic: " + subscriptionTopic); return new ResponseEntity<>("{}", HttpStatus.OK); }
Example 3
Source File: SubscribeProcessor.java From lemon with Apache License 2.0 | 4 votes |
@PreDestroy public void destroy() { for (DefaultMessageListenerContainer defaultMessageListenerContainer : defaultMessageListenerContainers) { defaultMessageListenerContainer.destroy(); } }