如何在发送消息后检索 JMS 消息标头但不使用该消息?
这是我的消息发送代码
jmsTemplate.convertAndSend(que, text, message -> {
LOGGER.info("setting JMS Message header values");
message.setStringProperty(RequestContext.HEADER_ID, id);
// LOGGER.info(message.getJMSMessageId()); -- this gives a null value here
return message;
});
Run Code Online (Sandbox Code Playgroud)
消息头仅在消息发布到队列后生成,因此在使用 MessagePostProcessor 时是否有一种简单的方法来检索 JMS 消息头?
ActiveMQ 的默认配置在activemq.xml文件中声明如下:
<beans>
...
<broker>
...
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70"/>
</memoryUsage>
...
</systemUsage>
</systemUsage>
</broker>
</beans>
Run Code Online (Sandbox Code Playgroud)
仅使用 JVM 堆的 70% 而不是 100% 作为内存限制的原因是什么?
这不是浪费资源吗?
有没有办法在Mac OS系统启动时自动启动activemq服务器?我希望每次启动系统时它都会启动。
我试图在官方文档中查找,但没有找到。
我正在尝试 Pythonstomp客户端通过 ActiveMQ 向 JVM 发送二进制消息,我需要它作为 JMS BytesMessage,但它是作为TextMessage.
我想这应该是可能的,因为我可以做相反的事情(JVM 到 Python),但不确定如何做。
有人知道其中的窍门吗?
我正在尝试使用 STOMP 协议向我的 activemq 发送消息,但出现以下错误:
(limetray) Vaibhavs-MacBook-Air:Desktop vaibhav$ python receiver_topic.py heyhey
Unknown response frame type: ';activemq' (frame length was 11)
Unknown response frame type: '
' (frame length was 2)
Unknown response frame type: ')' (frame length was 2)
Unknown response frame type: '
' (frame length was 1)
Unknown response frame type: 'tcpnodelayenabled' (frame length was 20)
Unknown response frame type: 'sizeprefixdisabled' (frame length was 20)
Unknown response frame type: ' cachesize' (frame length was 11)
Unknown response frame …Run Code Online (Sandbox Code Playgroud) 很多星期前我推荐我发送电子邮件,ActiveMQ.所以我搜索有关这方面的信息,但我完全不明白这是如何工作的.有人可以解释一下为什么我应该使用ActiveMQ发送电子邮件?
ActiveMQ CPP和Visual Studio 2003
我有一个要求让AMQ使用一些需要VS 7.1的代码,但是我很难获得它和使用VS 7.1构建的各种Apache库如apr等.有一个针对AMQ-CPP的vs2008解决方案/项目,我已将其用作模板,并尝试为VS 7.1创建一个,
但是在尝试构建时,我会收到如下错误:
"\amq\activemq-cpp-library-3.4.1\src\main\activemq\util\primitivemap.cpp(70): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\Utc\src\P2\main.c', line 148)"
Run Code Online (Sandbox Code Playgroud)
总之,有没有人能够使用VS 7.1构建并成功运行AMQ?是否支持编译器?
我已经浏览了常见问题解答(没有找到任何表明方式或其他方式)并在他们的ML上发布了问题,但无济于事.
任何信息或链接都会很棒.
如何使用队列中的特定标头消息.我正在使用camel activemq.
routebuilder:
.....
from("activemq:Q1").
.setHeader("myHeader",xpath(...))
.to("activemq:Q2")
.....
Run Code Online (Sandbox Code Playgroud)
我尝试使用那些在另一个类中具有特定标题的消息.
....
ConsumerTemplate consumerTemplate = camelContext.createConsumerTemplate();
Exchange exchange = consumerTemplate.receive("activemq:Q2",10000);
String body = exchange.getIn().getBody(String.class);
String customvalue = exchange.getIn().getHeader("myHeader", String.class);
.....
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得myHeader = 123的那些消息.
我正在尝试在activemq中使用授权,但是现在停滞了一段时间。
这是我的Java代码,删除授权插件后一切正常。我正在尝试创建一个名为“ room2”的主题。
Context jndiContext = new InitialContext();
ConnectionFactory connectionFactory;
connectionFactory = (ConnectionFactory) jndiContext
.lookup("ConnectionFactory");
connection = connectionFactory.createConnection("system", "manager");
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic t = session.createTopic("room2");
Run Code Online (Sandbox Code Playgroud)
这是我的activemq.xml:
<plugins>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="system" password="manager"
groups="admins,publishers,consumers"/>
<authenticationUser username="user" password="password"
groups="admins,users,publishers"/>
<authenticationUser username="guest" password="password" groups="guests"/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
<authorizationMap>
<authorizationEntries>
<authorizationEntry topic="room2" read="consumers" write="publishers" admin="admins" />
</authorizationEntries>
</authorizationMap>
</map>
</authorizationPlugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
User system is not authorized to create: topic://ActiveMQ.Advisory.Connection
Run Code Online (Sandbox Code Playgroud)
如果我使用<authorizationEntry topic=">" read="consumers" write="publishers" admin="admins" />,那么它可以正常工作,那么究竟是什么>意思呢?
我有两个接收者,应该从一个主题中阅读。但是只有一个随机接收者会收到消息,就像它实际上是从队列中读取而不是主题一样。我已经读过这个答案,但是似乎没有用。这是我的代码。
Application.java:
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.config.JmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
import org.springframework.jms.support.converter.MessageConverter;
import org.springframework.jms.support.converter.MessageType;
import javax.jms.ConnectionFactory;
@SpringBootApplication
@EnableJms
public class Application {
public static final String MAILBOX_TOPIC = "inbox.topic";
public static void main(String[] args) {
// Launch the application
ConfigurableApplicationContext context = SpringApplication.run(Application.class, args);
JmsTemplate jmsTemplate = context.getBean(JmsTemplate.class);
// Send a message with a POJO - the template reuse the message converter
System.out.println("Sending an …Run Code Online (Sandbox Code Playgroud) activemq-classic ×10
java ×2
jms ×2
stomp ×2
activemq-cpp ×1
apache-camel ×1
build ×1
c++ ×1
jmstemplate ×1
macos ×1
messaging ×1
python ×1
spring ×1
spring-boot ×1
spring-jms ×1
startup ×1
system ×1