title: How can I set expiration for Queues in Activemq if user not subscribed in specific period of time?
body: <p>How can I delete queues from activeMQ if user not subscribes , I have a lot of users in system so I think will be performance issue if users not deleted from activeMQ , I am using spring boot and WebSocketConfig, this my implementation:</p>
  
  <pre><code>@Service
  public  class NotificationWebSocketService {
      @Autowired
      private SimpMessagingTemplate messagingTemplate;
  
      public void initiateNotification(WebSocketNotification notificationData) throws InterruptedException {
  
          Map&lt;String, Object&gt; headers = new HashMap&lt;&gt;();
          headers.put("expires", System.currentTimeMillis() + 20000);
  
          messagingTemplate.convertAndSendToUser(notificationData.getUserID(), "/reply", notificationData.getMessage(),headers);
  
      }
  }
  
  
  
  @Configuration
  @EnableWebSocketMessageBroker 
  public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
  
        @Override
          public void configureMessageBroker(MessageBrokerRegistry config) {
  
            config
              .setApplicationDestinationPrefixes("/app")
              .setUserDestinationPrefix("/user")
              .enableStompBrokerRelay("/topic","/queue","/user")
  
              .setRelayHost("localhost")
              .setRelayPort(61613);
  
  
          }
  
  
          public void registerStompEndpoints(StompEndpointRegistry registry) {
              registry.addEndpoint("/websocket").withSockJS();
          }
  
  
  }
  </code></pre>