我正在尝试使用 MySql 配置 Activemq。一切似乎都已正确配置,因为我能够通过代码发送和接收消息。但我无法在 Activemq Web 控制台中看到任何队列或消息信息。
下面是我的 activemq 配置。任何帮助表示赞赏。
谢谢你!
Activemq.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<broker useJmx="false" brokerName="jdbcBroker" xmlns="http://activemq.apache.org/schema/core">
<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="default" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>
</broker>
<bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
<property name="username" value="admin"/>
<property name="password" value="root"/>
<property name="maxActive" value="200"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
<import resource="jetty.xml"/>
</beans>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用MDB内置的 ActiveMQ Artemis 来连接 Wildfly 10 服务器,以连接到运行版本 5.13.3 的独立 ActiveMQ-Server。似乎 Artemis 无法与任何受支持的 ActiveMQ 协议进行通信。
ActiveMQ 独立代理具有以下功能transportConnectors:
<transportConnectors>
<transportConnector name="auto" uri="auto://localhost:5671?protocolDetectionTimeOut=5000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="http" uri="http://0.0.0.0:8180?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600" />
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
Run Code Online (Sandbox Code Playgroud)
Wildfly MessageBean具有以下内容Annotation:
@MessageDriven(activationConfig =
{
@ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
@ActivationConfigProperty(propertyName="destination", "TestDestination"),
@ActivationConfigProperty(propertyName="clientID", propertyValue = "test"),
@ActivationConfigProperty(propertyName="connectionParameters", propertyValue = "host=127.0.0.1;port=5671"),
@ActivationConfigProperty(propertyName="connectorClassName", propertyValue = "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory"),
@ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")
}, mappedName = "TestDestination")
public class MessageProcessingBean implements MessageListener …Run Code Online (Sandbox Code Playgroud) 使用 Java/Spring 与 WebSphere MQ 交互并尝试向其发送消息,Spring 不断向其添加以下标头信息:
RFH Ì ¸MQSTR ¸ <mcd><Msd>jms_text</Msd></mcd> <jms><Dst>queue:///MY.QUEUE.INFORMATION.TEST</Dst><Rto>queue:///MY.QUEUE.INFORMATION.TEST</Rto><Tms>123456789</Tms><Dlv>2</Dlv></jms>BEGINNING_OF_MY_PAYLOAD
我将如何删除所有内容并仅发送我的有效负载?人们可以在上面的代码片段中将我的有效负载称为BEGINNING_OF_MY_PAYLOAD.
这是我正在使用的功能:
public void sendMessage(final String text) {
this.jmsTemplate.send(new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
Message message = session.createTextMessage(text);
destination = session.createQueue("MY.QUEUE.INFORMATION.TEST");
springJmsConsumer.setDestination(destination);
message.setJMSReplyTo(destination);
return message;
}
});
}
Run Code Online (Sandbox Code Playgroud) 我想将消息推送到 azure 服务总线,比如大小为 3 MB。为此,我写道:
QueueInfo queueInfo = new QueueInfo("sq-jcibe-microservice-plm-qa");
long maxSizeInMegabytes = 5120;
queueInfo.setMaxSizeInMegabytes(maxSizeInMegabytes);
service.updateQueue(queueInfo);
service.sendQueueMessage("sq-jcibe-microservice-plm-qa", brokeredMessage);
Run Code Online (Sandbox Code Playgroud)
我收到以下异常。
com.microsoft.windowsazure.exception.ServiceException: com.sun.jersey.api.client.UniformInterfaceException: PUT https://sb-jcibe-microservice-qa.servicebus.windows.net/sq-jcibe-microservice-plm-qa?api-version=2013-07 returned a response status of 400 Bad Request
Response Body: <Error><Code>400</Code><Detail>SubCode=40000. For a Partitioned Queue, ordering is supported only if RequiresSession is set to true.
Parameter name: SupportOrdering. TrackingId:59bb3ae1-95f9-45e1-8896-d0f6a9ac2be8_G3, SystemTracker:sb-jcibe-microservice-qa.servicebus.windows.net:sq-jcibe-microservice-plm-qa, Timestamp:11/30/2016 4:52:22 PM</Detail></Error>
Run Code Online (Sandbox Code Playgroud)
我不明白这是什么意思,我应该如何解决这个问题。请帮我解决这个问题。?
我使用 spring-boot-starter-data-jpa 和 spring-boot-starter-activemq 制作了一个 POC。我想在提交 jpa 事务时将 jms 消息推送到代理(activeMQ)上。
我的代码:UtilsateurService 具有“主要”事务:
@Service
public class UtilisateurService {
@Autowired
private UtilisateurRepository utilisateurRepository;
@Autowired
private SendMessage sendMessage;
@Transactional(rollbackOn = java.lang.Exception.class)
public Utilisateur create(Utilisateur utilisateur) throws Exception {
final Utilisateur result = utilisateurRepository.save(utilisateur);
sendMessage.send("creation utilisateur : " + result.getId());
throw new Exception("rollback");
//return result;
}
}
Run Code Online (Sandbox Code Playgroud)
SendMessage 类女巫“管理”Jms 消息:
@Component
public class SendMessage {
@Autowired
private JmsMessagingTemplate jmsMessagingTemplate;
@Value("${jms.queue.destination}")
private String destinationQueue;
public void send(String msg) {
this.jmsMessagingTemplate.convertAndSend(destinationQueue, msg);
}
}
Run Code Online (Sandbox Code Playgroud)
我的主要课程:
@SpringBootApplication …Run Code Online (Sandbox Code Playgroud) 我在 jms 引擎盖下使用 tibco 驱动程序来创建与 ems 代理的客户端连接...我想过将驱动程序升级到最新最好的,然后才开始想知道 javax.jms 包是否向后兼容以及版本差异是什么包含?示例:旧的 tibco 驱动程序打包在(我认为是因为它没有在任何地方明确指定)javax.jms 1.1(建于 2002 年 4 月)但是新驱动程序与 jms 2.0 捆绑在一起
这是我的配置:
@Bean
ActiveMQConnectionFactory activeMQConnectionFactory() {
String url = this.environment.getProperty("jms.broker.url");
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
connectionFactory.setBrokerURL(url);
connectionFactory.setRedeliveryPolicy(redeliveryPolicy());
return connectionFactory;
}
@Bean
public RedeliveryPolicy redeliveryPolicy() {
RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
redeliveryPolicy.setInitialRedeliveryDelay(500);
redeliveryPolicy.setBackOffMultiplier(2);
redeliveryPolicy.setUseExponentialBackOff(true);
redeliveryPolicy.setMaximumRedeliveries(5);
return redeliveryPolicy;
}
.....
Run Code Online (Sandbox Code Playgroud)
这是我的消费者:
@Service("msgConsumer")
public class MessageConsumer {
private static final String ORDER_RESPONSE_QUEUE = "thequeue.Q";
@JmsListener(destination = ORDER_RESPONSE_QUEUE, containerFactory = "jmsListenerContainerFactory")
public void receiveMessage(final Message<String> message) throws Exception {
MessageHeaders headers = message.getHeaders();
LOG.info("Application : headers received : {}", headers);
String response = message.getPayload();
LOG.info("Application …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用基本构建的 Java 客户端使用带有 SSL 的 IBM MQ(版本 8.0.0.8):
MQ 是请求/回复类型。
我有正确的证书和所有 MQ 属性设置,但由于某种原因,连接“断开”,我的客户端没有错误,我的请求从未得到任何响应,并“永远”运行,从未得到任何响应。我唯一的线索是 MQ 日志中的一条错误消息,内容为:
Run Code Online (Sandbox Code Playgroud)Process(31600.16) User(QMQM) Jobname(JOB_NAME) Host(HOST_NAME) VRMF(8.0.0.8) QMgr(MANAGER_NAME) AMQ9638: SSL communications error for channel 'CHANNEL_NAME'. EXPLANATION: Cause . . . . . : An unexpected SSL communications error occurred for a channel, as reported in the preceding messages. The channel is 'CHANNEL_NAME';
奇怪的是发生了 SSL 握手,我的证书被 MQ 接受,但由于某种原因,在此之后发生了一些事情。我正在尝试同时使用 Oracle JRE 8 和 IBM JRE 7。也许是 MQ 端的某些东西(IBM MQ …
我正在尝试恢复由于目标无法访问而发送回 ActiveMQ 队列的消息。我正在避免重新交付政策,因为它不符合我的要求。我需要在我的应用程序中使用 session.recover() 在准确的时间恢复这些消息。
我目前正在为 spring boot 使用接近默认的 jms 配置,它允许使用 @JmsListener 注释。但是我找不到一种方法来获取此注释使用的活动 jms 会话的句柄?
我正在尝试使用来自 MQ 的消息,但代码挂起且不显示输出。
JmsFactoryFactory FF = jmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
JmsConnectionFactory cf = FF.createConnectionFactory();
cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, HOST);
cf.setStringProperty(WMQConstants.WMQ_PORT, PORT);
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, CHANNEL);
cf.setStringProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, QMGR);
cf.setStringProperty(WMQConstants.WMQ_APPLICATIONNAME, "JMS");
Connection connection = cf.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = session.createQueue(queuename);
MessageConsumer consumer1 = session.createConsumer(destination);
Message reply = consumer1.receive();
System.out.println(reply);
Run Code Online (Sandbox Code Playgroud)
它不显示消息并挂起,甚至不终止。
jms ×10
java ×7
ibm-mq ×3
spring ×2
spring-boot ×2
spring-jms ×2
azure ×1
dead-letter ×1
mysql ×1
servicebus ×1
ssl ×1
tibco ×1
wildfly ×1