小编Lau*_*res的帖子

Broker Network充斥着未消耗的ActiveMQ.Advisory.TempQueue消息

我正在调查我的经纪人网络中的内存问题.根据JConsole,当代理开始阻止消息时,ActiveMQ.Advisory.TempQueue占用了99%的已配置内存.

有关配置的一些细节

大部分默认配置.一个打开的stomp + nio连接器,一个打开的openwire连接器.所有代理都形成一个超立方体(一个与其他代理的一个路上连接(更容易自动生成)).没有流量控制.

问题详情

webconsole在30个消费者(6个代理,一个消费者,其余是使用java连接器的客户端)中显示了1974234排队和45345个出列消息.据我所知,出队数量不应小于:排队*消费者.所以在我的情况下,大量的建议没有消耗,并开始填补我的临时消息空间.(目前我配置了几个gb作为临时空间)

由于没有客户主动使用临时队列,我发现这很奇怪.看了一下临时队列后我更加困惑了.大多数消息看起来像这样(msg.toString):

ActiveMQMessage {commandId = 0, responseRequired = false, messageId = ID:srv007210-36808-1318839718378-1:1:0:0:203650, originalDestination = null, originalTransactionId = null, producerId = ID:srv007210-36808-1318839718378-1:1:0:0, destination = topic://ActiveMQ.Advisory.TempQueue, transactionId = null, expiration = 0, timestamp = 0, arrival = 0, brokerInTime = 1318840153501, brokerOutTime = 1318840153501, correlationId = null, replyTo = null, persistent = false, type = Advisory, priority = 0, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = …
Run Code Online (Sandbox Code Playgroud)

activemq-classic

6
推荐指数
1
解决办法
5693
查看次数

如何使用Rijndael加密或解密,块大小为256位?

出于某些原因,我需要使用256位的块大小来实现Rijndael de/compression,而不是使用128位块大小的AES(原因:数据使用Rijndael在PHP中加密......).

如何更改密码的块大小?

如果我只是得到一个密码,"RIJNDAEL/CFB/PKCS5Padding"并尝试初始化一个256位的IV,我得到一个例外,因为块大小只有128位.

java encryption cryptography aes rijndael

6
推荐指数
1
解决办法
9636
查看次数

PreAuthorize不起作用

我正在编写套接字服务器(没有web应用程序!)应用程序,并希望使用基于方法的安全性来处理我的ACL需求.我按照一个小教程,通过示例找到了弹簧安全性

到目前为止我配置:

<security:global-method-security pre-post-annotations="enabled">
    <security:expression-handler ref="expressionHandler" />
</security:global-method-security>
<bean id="expressionHandler" class="org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
    <property name="permissionEvaluator">
        <bean id="permissionEvaluator" class="myPermissionEvaluator" />
    </property>
</bean>

<security:authentication-manager id="authenticationmanager">
    <security:authentication-provider ref="authenticationprovider" />
</security:authentication-manager>
<bean id="authenticationprovider" class="myAuthenticationProvider" />
Run Code Online (Sandbox Code Playgroud)

使用服务bean:

@Named
public class ChannelService {
    @PreAuthorize("isAuthenticated() and hasPermission(#channel, 'CHANNEL_WRITE')")
    public void writeMessage(Channel channel, String message) { ... }
}
Run Code Online (Sandbox Code Playgroud)

一切都编译,应用程序启动并正常工作,但没有访问控制.我的调试日志显示我的Evaluator永远不会被调用.

当我尝试使用@Secured注释类似的东西时,注释被评估并且访问被拒绝.但基于角色的简单安全性不足以满足我的要求.

EDIT 做了一些测试:当我只配置secure-annotations ="enabled"时,基于角色的安全性工作.当在ADDITION中配置pre-post-annotations ="enabled"时既不安全也不预授权.当我只配置预注释后,它仍然无法正常工作.

EDIT2

一些更多的测试:只有secured_annotations ="enabled",我的频道服务的调用一旦激活前后注释,就会通过Cglib2AopProxy直接调用到频道服务中.没有拦截器,没有代理,没有.

我变得有点绝望......

EDIT3

我在这里调试记录我的测试是spring-security的一部分

只有secure-annotations ="enabled"

2012-04-12 13:36:46,171 INFO  [main] o.s.s.c.SpringSecurityCoreVersion - You are running with Spring Security …
Run Code Online (Sandbox Code Playgroud)

spring spring-security

6
推荐指数
1
解决办法
2万
查看次数

数千个主题的高性能 DefaultMessageListenerContainer 配置

对于我当前的项目,我需要使用来自许多目的地(从数百到 20 或 30k)的消息,所有目的地都是主题。当前(对于初始负载测试)所有消息都在同一服务器的本地线程池中创建。

我当前的 spring 配置在代理网络(用于集群)和 DefaultMessageListenerContainers (DMLCs) 网络中使用嵌入式 activemq,带有一个公共 TaskExecutor。虽然目的地数量非常多,但每个目的地的吞吐量相对较低。

我唯一的要求是尽快消耗所有消息。

我的配置:

<bean id="connectionfactory" class="org.springframework.jms.connection.CachingConnectionFactory" destroy-method="destroy">
    <property name="targetConnectionFactory">
        <ref bean="amqConnectionFactory" />
    </property>
</bean>
<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="vm://localhost:61616?async=false&amp;jms.dispatchAsync=false" />
    <property name="userName" value="admin" />
    <property name="password" value="admin" />
</bean>
<bean id="listenerThreadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    <property name="corePoolSize" value="70" />
    <property name="maxPoolSize" value="70" />
    <property name="daemon" value="true" />
    <property name="keepAliveSeconds" value="60" />
</bean>

<!-- Message Listener Container Template for Topics -->
<bean id="topiccontainertemplate" class="org.springframework.jms.listener.DefaultMessageListenerContainer" scope="prototype"
    destroy-method="destroy">
    <property name="autoStartup" value="false" />
    <property name="connectionFactory" …
Run Code Online (Sandbox Code Playgroud)

java spring activemq-classic jms spring-jms

5
推荐指数
2
解决办法
2万
查看次数

Jackson 2.0与Jackson 1.x注释的兼容性?

我有一个较旧的框架类,用jackson 1.x注释.我的应用程序使用jackson 2.0来处理json序列化.是否可以配置jackson 2.0来理解"旧"注释?目前这些注释被忽略了.

json backwards-compatibility jackson

5
推荐指数
1
解决办法
1108
查看次数

当 GKE 工作负载出现问题时,在 Stackdriver 中创建事件和通知

我有一个 gke 集群,其中一些工作负载可能会出现启动问题。当工作负载遇到问题时是否可以创建 stackdriver 通知。

例如:当 CrashLoopBackOff 被触发、Pod 不可调度或工作负载状态在 5 分钟内处于非正常状态时,创建一个事件。

monitoring google-kubernetes-engine stackdriver

5
推荐指数
1
解决办法
1875
查看次数

JVM幸存下来System.exit(1)

我目前正在使用system.exit(1)维护一个在发生故障时关闭的系统.不幸的是,当发生这种情况时,系统的java进程仍然存在.

调用system.exit时jvm怎么可能没有关闭?

java

3
推荐指数
1
解决办法
2103
查看次数

如何使用 spring-boot 外部化数据源配置?

我目前正在尝试将现有的 spring-application 移动到 spring-boot,因此重新创建无需启动即可工作的内容。

我想从外部源配置一些属性(如 spring.datasource.*)。特别是一个包含多个属性文件的文件夹。

我设置了一个配置类,用于创建如下所示的 propertyPlaceholder 配置器:

@Configuration
public class PropertySourceConfiguration {

@Bean
public static PropertySourcesPlaceholderConfigurer defaultsPlaceHolderConfigurer() throws IOException {
    PropertySourcesPlaceholderConfigurer propertyConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertyConfigurer.setLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:/*-defaults.properties"));
    propertyConfigurer.setIgnoreUnresolvablePlaceholders(true);
    return propertyConfigurer;
}

@Bean
public static PropertySourcesPlaceholderConfigurer externalPlaceHolderConfigurer() throws IOException {
    PropertySourcesPlaceholderConfigurer propertyConfigurer = new PropertySourcesPlaceholderConfigurer();
    propertyConfigurer.setLocations(new
            PathMatchingResourcePatternResolver().getResources("file:/my-config-path/*.properties"));
    propertyConfigurer.setOrder(1);
    propertyConfigurer.setIgnoreUnresolvablePlaceholders(true);
    return propertyConfigurer;
}
Run Code Online (Sandbox Code Playgroud)

这似乎适用于大多数事情(例如 amqp 或我自己的配置属性),但是当我尝试使用 spring-data-jpa 时,它们会被忽略。基本上spring.datasource.url在这些文件中设置(和其他用于自动配置的东西)不起作用。

查看日志,PropertySourcesPropertyResolver我发现这些配置器属于localProperties查找spring.datasource.*.

有没有办法解决这个问题,或者有更好的方法将外部属性文件添加到我的上下文中?

我知道我可以设置spring.config.location做类似的事情,但我无法将命令行属性传递给我的应用程序,需要在我的应用程序中执行此配置。afaik 这对这个属性是不可能的。

编辑:设置spring.config.location

尝试 1:

public class …
Run Code Online (Sandbox Code Playgroud)

spring spring-data-jpa spring-boot

3
推荐指数
1
解决办法
6963
查看次数

如何在没有轮询的情况下向客户端发送消息?

GAE Chats的每个例子都使用某种轮询.但是,如果我的GAE应用程序包含客户端列表(必要时在数据存储区中),也许我可以通过向所有这些客户端发送消息来避免轮询.我怎样才能做到这一点?

google-app-engine chat

1
推荐指数
1
解决办法
557
查看次数