Message transmission for Active MQ of JMS, jmsmq

Source: Internet
Author: User

Message transmission for Active MQ of JMS, jmsmq

This document uses Active MQ5.6

1. Message Broker)

Broke: the message switch, which is the container for Message Management. ActiveMQ can create multiple brokers, and the client interacts with ActiveMQ. In fact, it interacts with the Broker in ActiveMQ. The Broker is configured in $ {MQ_HOME} \ conf \ activemq. xml.

 

2. Connector)(1) transportors)

Transportors ors connector: establishes interactions between brokers, message producers, and consumers.

Common protocols for transmission connectors:

Commonly used connection protocols in Active MQ: tcp, udp, nio, ssl, http, https, and vm. If you need to configure a certificate to use the ssl protocol, use http or https to use httpclient to send and receive messages.

(1) default TCP protocol

Tcp: // hostname: port? Key = value & key = parameter optional after value
Benefits of using TCP

  • Efficient: The Protocol connection uses the OpenWire protocol, which converts messages into word throttling and delivers excellent performance.
  • Availability: TCP is a widely used network protocol, which is basically supported by all platforms.

TCP configuration example conf/activemq. xml:

<Transportors ors> <! -- Activemq default connection tcp --> <transportconnename = "openwire" uri = "tcp: // 0.0.0.0: 61616"/> </transportors ors>

(2) NIO
A. NIO is similar to TCP, but NIO focuses more on underlying access operations. It allows developers to have more client calls and more load on the server for the same resource.
B. Applicable to NIO protocol scenarios:
A large number of clients may be linked to the Broker. Generally, a large number of clients are restricted by the number of threads in the operating system. Therefore, NIO requires fewer threads to run than TCP. Therefore, NIO protocol is recommended.
It may provide better performance for Broker to transmit NIO over a very slow network than TCP.
C. The URI format of the NIO connection: nio: // hostname: port? Optional parameters after key = value

D. Configure the instance conf/activemq. xml with NIO:

<Transportors ors> <! -- Set a NIO connection --> <transportctor name = "nio" uri = "nio: // 0.0.0.0: 61617"/> </transportors>

(3) UDP

A. Differences between UDP and TCP

  • TCP is a transmission protocol of the original stream, which means that data packets are guaranteed. In other words, data packets will not be reset or lost. UDP, on the other hand, does not guarantee the transmission of data packets.
  • TCP is also a stable and reliable data packet transmission protocol, which means that data will not be lost during transmission. This ensures reliable transmission between sending and receiving. On the contrary, UDP is only a link protocol, so it is not reliable.
  • TCP is used in stable and reliable scenarios. UDP is usually used in scenarios of fast data transmission and data loss. When ActiveMQ passes the firewall, only UDP can be used.

B. UDP connection URI format: udp: // hostname: port? Key = value

C. Configure the instance conf/activemq. xml

        <transportConnectors>            <transportConnector name="udp" uri="udp://localhost:61618"/>        </transportConnectors>

(4) SSL

The underlying layer is the TCP protocol, but the transmitted data is encrypted.
A. Applicable scenarios: MQ is exposed to the Internet and communication between the client and broker is required.

B. Procedure:
B-1, creating SSL protocols:
B-2, configure Broker SSL protocol conf/activemq. xml:

       <sslContext>            <sslContext keyStore="F:/beifeng/apache-activemq-5.6.0/conf/mybroker.ks"              keyStorePassword="test123" />       </sslContext>

B-3, configure client SSL protocol:

C. The URI format of the SSL connection: ssl: // hostname: port? Key = value

D. Configure the instance conf/activemq. xml

        <transportConnectors>            <transportConnector name="ssl" uri="ssl://localhost:61619"/>        </transportConnectors>

(5) HTTP and HTTPS

A. Receive http mq messages through the jetty container
B. Used for the network environment that only allows basic HTTP Services to pass
C. Use httpclient to send/receive messages. You must add an additional java package: Httpclient, Xstream, and activemq-optional.
D. URI: http: // hostname: port? Key = value

E. Configure the instance conf/activemq. xml:

     <transportConnectors>            <transportConnector name="http" uri="http://localhost:8080"/>        </transportConnectors>

To configure HTTPS, you must configure the relevant certificate HTTPS = HTTP + SSL in jetty. xml.

(2) NetWorkConnectors)

NetWorkConnectors: used for interaction between Broke and Broke. It is mainly used when the ActiveMq cluster is deployed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.