Spring boot 如何在ActiveMQ中删除非活动目标?
我需要配置activemq以删除非活动队列: 使用websocket的配置如下Spring boot 如何在ActiveMQ中删除非活动目标?,spring-boot,activemq,stomp,spring-websocket,Spring Boot,Activemq,Stomp,Spring Websocket,我需要配置activemq以删除非活动队列: 使用websocket的配置如下 @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry co
@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();
}
}
如何在spring引导中添加以下destinationPolicy?如何导入此部件?
将此bean定义添加到配置中
@Bean
public BrokerService broker() throws Exception {
BrokerService broker = new BrokerService();
broker.setSchedulePeriodForDestinationPurge(10000);
broker.addConnector("stomp://localhost:61613");
PolicyMap policyMap = new PolicyMap();
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setGcInactiveDestinations(true);
policyEntry.setInactiveTimeoutBeforeGC(30000);
policyEntry.setQueue(">");
List<PolicyEntry> entries = new ArrayList<PolicyEntry>();
entries.add(policyEntry);
policyMap.setPolicyEntries(entries);
broker.setDestinationPolicy(policyMap);
return broker;
}
@Bean
public BrokerService broker()引发异常{
BrokerService broker=新的BrokerService();
broker.setSchedulePeriodForDestinationPurge(10000);
broker.addConnector(“stomp://localhost:61613");
PolicyMap PolicyMap=新PolicyMap();
PolicyEntry PolicyEntry=新的PolicyEntry();
policyEntry.setGcInactiveDestinations(true);
policyEntry.setInactivateTimeoutBeforeGC(30000);
policyEntry.setQueue(“>”);
列表项=新的ArrayList();
条目。添加(保单条目);
policyMap.setPolicyEntries(条目);
broker.setDestinationPolicy(policyMap);
回报经纪人;
}
并验证您是否具有这些依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-stomp</artifactId>
</dependency>
org.springframework.boot
springbootstarteractivemq
org.apache.activemq
activemq跺脚
在活动MQ中是否有其他可用队列?行政观点?正如您所知,它嵌入了带有visualvm的MQJMX?默认情况下,它处于激活状态
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-stomp</artifactId>
</dependency>