activemq上使用stomp出现的问题 30C
WebSocket connection to 'ws://' failed: Error during WebSocket handshake: 'Sec-WebSocket-Protocol' header value 'stomp' in response does not match any of sent values



Csdn user default icon

<div class="post-text" itemprop="text"> <p>Is there a active Stomp client library for connecting to ActiveMQ using Go? <a href="" rel="nofollow">Go-Stomp</a> is last updated 8 months ago. I just started using it and ran into few problems such as </p> <ul> <li>no support for failover syntax (not a show stopper)</li> <li>Caching connection missing</li> <li>Can not check if a connection is closed or not. One has to compare the error returned from <strong>Send</strong> method.</li> </ul> <p>Before I continue to use it for production system, want to check if there is a preferred stomp client in Go other than Go-Stomp?</p> </div>

求大佬帮忙 php+stomp+activemq的问题

用的是stomp-php 在activemq里出现 ``` jvm 1 | WARN | Transport Connection to: tcp://0:0:0:0:0:0:0:1:50948 failed: Frame size of 1076 MB larger than max allowed 100 MB jvm 1 | WARN | Transport Connection to: tcp://0:0:0:0:0:0:0:1:50948 failed: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: tcp://0:0:0:0:0:0:0:1:50948 ``` php这边运行则是 ``` Notice: Undefined offset: 1 in D:\wamp64\www\vendor\fusesource\stomp-php\src\main\FuseSour ce\Stomp\Stomp.php on line 551 Fatal error: Uncaught exception 'FuseSource\Stomp\Exception\StompException' with message ' Unexpected command: ' in D:\wamp64\www\vendor\fusesource\stomp-php\src\main\FuseSource\Sto mp\Stomp.php:209 Stack trace: #0 D:\wamp64\www\test2.php(13): FuseSource\Stomp\Stomp->connect() #1 {main} thrown in D:\wamp64\www\vendor\fusesource\stomp-php\src\main\FuseSource\Stomp\Stomp.php on line 209 ```

Activemq和Php Stomp:同步生产者样本

<div class="post-text" itemprop="text"> <p>I'm trying have this principle working:</p> <ul> <li>a producer that sends <strong>one</strong> message (1) and waits for ack which contains some result (json result of an operation, actually)</li> <li>a consumer that checks all pending messages <em>every 5 seconds</em>, and handle all of them in one row, and acknowlegdes all of them in one row, then wait again 5 seconds (infinite loop).</li> </ul> <p>Here are the 30 lines of my <code>stompproducer.php</code>: </p> <pre><code>&lt;?php function msg($txt) { echo date('H:i:s &gt; ').$txt." "; } $queue = '/aaaa'; $msg = 'bar'; if (count($argv)&lt;3) { echo $argv[0]." [msg] [nb to send] "; exit(1); } $msg = (string)$argv[1]; $to_send = intval($argv[2]); try { $stomp = new Stomp('tcp://localhost:61613'); while (--$to_send) { msg("Sending..."); $result = $stomp-&gt;send( $queue, $msg." ". date("Y-m-d H:i:s"), array('receipt' =&gt; 'message-123') ); echo 'result='.var_export($result,true)." "; msg("Done."); } } catch(StompException $e) { die('Connection failed: ' . $e-&gt;getMessage()); } </code></pre> <p>Here are the 30 lines of my <code>stompconsumer.php</code>: </p> <pre><code>&lt;?php $queue = '/aaaa'; $_waitTimer=5000000; $_timeLastAsk = microtime(true); function msg($txt) { echo date('H:i:s &gt; ').$txt." "; } try { $stomp = new Stomp('tcp://localhost:61613'); $stomp-&gt;subscribe($queue, array('activemq.prefetchSize' =&gt; 40)); $stomp-&gt;setReadTimeout(0, 10000); while (true) { $frames_read=array(); while ($stomp-&gt;hasFrame()) { $frame = $stomp-&gt;readFrame(); if ($frame != null) { array_push($frames_read, $frame); } if (count($frames_read)==40) { break; } } msg("Nombre de frames lues : ".count($frames_read)); msg("Pause..."); $e=$_waitTimer-(microtime(true)-$_timeLastAsk); if ($e&gt;0) { usleep($e); } if (count($frames_read)&gt;0) { msg("Ack now..."); foreach ($frames_read as $frame) { $stomp-&gt;ack($frame); } } $_timeLastAsk = microtime(true); } } catch(StompException $e) { die('Connection failed: ' . $e-&gt;getMessage()); } </code></pre> <p>I can't manage to do synchronous producer, ie producer that waits for consumer ack. If you run the samples I've done here, you'll see that producer <em>instantaneously</em> sends all messages, then quits, with all "true" like "ok" results when calling <code>$stomp-&gt;send()</code>. I still haven't found good examples, neither good documentation with a simple blocking sample.</p> <p>What shall I do to make my producer blocking until the consumer sends its ack?</p> <p>NB: I've read all documentation <a href="" rel="nofollow noreferrer">here</a> and the stomp php questions on stackoverflow <a href="">here</a> and <a href="">here</a>.</p> </div>


<div class="post-text" itemprop="text"> <p>我正在试图通过库连接到AWS上的ActiveMQ实例。</p> <p>以下代码引发了无效的命令错误:</p> <pre><code>func (s *STOMP) Init() error { netConn, err := stomp.Dial("tcp", "host:61614") if err != nil { return errors.Wrap(err, "dial to server") } s.conn = netConn return nil } </code></pre> </div>

go stomp客户端中ActiveMQ的故障转移URI

<div class="post-text" itemprop="text"> <p>How do we connect to ActiveMQ using failover stomp connection URI in Go? Using <a href="" rel="nofollow">Go-Stomp</a> client, I tried below code and it fails to connect.</p> <pre><code>if conn, err = stomp.Dial("tcp", "failover:(tcp://,tcp://"); err != nil { panic(fmt.Sprintf("Could not connect to ActiveMQ using brokerUri %v. Can not continue.", Config.Broker.URI)) } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>Using Go-Stomp, one can obtain the connection using below code.</p> <pre><code>if conn, err = stomp.Dial("tcp", Broker.URI, stomp.ConnOpt.Login(Broker.User, Broker.Password)); err != nil { panic(fmt.Sprintf("Could not connect to ActiveMQ using brokerUri %v. Can not continue.", Broker.URI)) } </code></pre> <p>Can the connection be cached to reuse to send messages for different requests? Or do we need to obtain the connection each time one wants to send a message? <br>Later sounds in-efficient.<br> <strong>Send</strong> method on the connection instance closes the connection in case of failures. So if we cache it, one has to check if the connection is still live for subsequent send message invocations. But I did not find a method to check if the connection is closed? <strong>Conn</strong> struct has <strong>closed</strong> member but this is not exposed via any method.</p> <pre><code>// A Conn is a connection to a STOMP server. Create a Conn using either // the Dial or Connect function. type Conn struct { conn io.ReadWriteCloser readCh chan *frame.Frame writeCh chan writeRequest version Version session string server string readTimeout time.Duration writeTimeout time.Duration closed bool options *connOptions } </code></pre> </div>

PHP + Stomp + ActiveMq,“AMQ_SCHEDULED_DELAY”不起作用

<div class="post-text" itemprop="text"> <p>I'm using laravel framework based on php.And Stomp+activeMQ. Here I need to send something into mq, however the message should be consumed after 180 seconds, not immediately.</p> <p>Option1, I send it with a timestamp, and the consumer will check the timestamp.If interval &gt; 180, then do something and ack().</p> <p>Option1 is inefficient, for every moment the consumer is checking timestamp but very few messages are acked.</p> <p>Option2, shell_exec("php send.php | at now + 3 minute"), it looks strange.</p> <p>Are there any better solutions?</p> <p>I have set "AMQ_SCHEDULED_DELAY" according to Lee's advice, however the message will be sent immediately, too.Maybe the delay config can only be used to PUB/SUB but not PTP?Here is my code:</p> <pre><code> $con = new Stomp(config('app.mq_url')); if (!$con-&gt;isConnected()) { $con-&gt;connect(); $con-&gt;setReadTimeout(3); } $con-&gt;begin("Transaction"); $options =[ 'persistent'=&gt; $persistent, 'AMQ_SCHEDULED_DELAY' =&gt; $delay * 1000 ]; $con-&gt;send($queue, json_encode($params), $options); $con-&gt;commit("Transaction"); $con-&gt;disconnect(); $con-&gt;send($queue, json_encode($params), $options); </code></pre> <p>And I remember to set schedulerSupport=true in activemq.xml.</p> <p>I refer to this: <a href="" rel="nofollow noreferrer">ActiveMq Doc</a>, is this concerned? I don't know.Or is it OK to send 'AMQ_SCHEDULED_DELAY' in header? Because <a href="" rel="nofollow noreferrer">ActiveMq Doc: Stomp</a> does not list it as a header.</p> <blockquote> <p>Check your Message Properties The message property scheduledJobId is reserved for use by the Job Scheduler. If this property is set before sending, the message will be sent immediately and not scheduled. Also, after a scheduled message is received, the property scheduledJobId will be set on the received message so keep this in mind if using something like a Camel Route which might automatically copy properties over when re-sending a message.</p> </blockquote> </div>


<div class="post-text" itemprop="text"> <p>I am using PHP 7.0 with Apache2 in Ubuntu trusty.</p> <p>I have installed the STOMP library doing</p> <pre><code>wget pear install stomp-2.0.0.tgz </code></pre> <p>And adding to my php.ini.</p> <p>With phpinfo() I can see the Stomp installed correctly:</p> <p><a href="" rel="nofollow"><img src="" alt="enter image description here"></a></p> <p>But I have this script:</p> <pre><code>&lt;?php $foo = new Stomp('tcp://localhost:61613'); </code></pre> <p>And When I run this error is shown:</p> <blockquote> <p>PHP Fatal error: Uncaught Error: Class 'Stomp' not found in /vagrant/www/web/activemq-server.php:3 Stack trace:</p> <h1>0 {main} thrown in /vagrant/www/web/activemq-server.php on line 3</h1> </blockquote> <p><strong>UPDATE:</strong></p> <p><strong>This problem happens only when the script is run from console</strong>. If the script is run from browser then it works correctly.</p> </div>


<div class="post-text" itemprop="text"> <p>I am not sure whether this question is related to <a href="" rel="nofollow noreferrer">stomp-php</a> or <a href="" rel="nofollow noreferrer">ActiveMQ Docker</a> (running with defaults).</p> <p>I have a simple Queue helper class written in PHP that handles both sending the message to the queue (<code>Queue::push</code>), as well as consumes it (<code>Queue::fetch</code>). See code below.</p> <p>As you can see, <code>fetch()</code> should subscribe to the queue, read one message and unsubscribe. The message should be acknowledged automatically (<code>\Stomp\StatefulStomp::subscribe()</code>, 3rd. argument).</p> <p>For some reason, about 5-7% of the messages are received by the customer twice or even three times. <strong>Why messages are delivered multiple times and how to avoid it?</strong></p> <hr> <p>Publisher (pushing 1000 messages):</p> <pre class="lang-php prettyprint-override"><code>$mq = new Queue('tcp://activemq:61613','test'); for ($msgCount = 0; $msgCount &lt; 1000; $msgCount++) { $mq-&gt;push('Message #' . $msgCount); } </code></pre> <p>Consumer (receiving ~1070 messages):</p> <pre class="lang-php prettyprint-override"><code>$mq = new Queue('tcp://activemq:61613','test'); $received = 0; while (true) { $message = $mq-&gt;fetch(); if (null === $message) { break; } $received++; } </code></pre> <p>Queue class code:</p> <pre class="lang-php prettyprint-override"><code>use Stomp\Client; use Stomp\Network\Connection; use Stomp\SimpleStomp; use Stomp\StatefulStomp; use Stomp\Transport\Message; class Queue { /** * @var \Stomp\StatefulStomp */ private $stomp; private $queue; public function __construct($uri, $queue) { $connection = new Connection('tcp://activemq:61613'); $this-&gt;stomp = new StatefulStomp(new Client($connection)); $connection-&gt;setReadTimeout(1); $this-&gt;queue = $queue; } public function push($body) { $message = new Message($body, ['activemq.maximumRedeliveries' =&gt; 0]); $this-&gt;stomp-&gt;send('/queue/' . $this-&gt;queue, $message); } public function fetch() { $subscriptionId = $this-&gt;stomp-&gt;subscribe('/queue/' . $this-&gt;queue, null, 'auto', ['activemq.prefetchSize' =&gt; 1]); $msg = $this-&gt;stomp-&gt;read(); $this-&gt;stomp-&gt;unsubscribe($subscriptionId); return $msg; } } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>Ok, so here's the deal. I was reading <a href="" rel="nofollow">this tutorial</a> and the <a href="" rel="nofollow">documentation</a> from the ActiveMQ website.</p> <p>On the documentation we have, under <em>Message Transformations</em>, this sentence:</p> <blockquote> <p>The transformation message header on SEND and SUBSCRIBE messages could be used to instruct ActiveMQ to transform messages from text to the format of your desire. Currently, ActiveMQ comes with a transformer that can transform XML/JSON text to Java objects</p> </blockquote> <p>and</p> <blockquote> <p>ActiveMQ uses XStream for its transformation needs. Since it's the optional dependency you have to add it to broker's classpath by putting the appropriate JAR into the lib/ folder. Additionally, if you plan to use JSON transformations you have to add Jettison JSON parser to the classpath.</p> </blockquote> <p>So I did this, I've annotated my pojo with <em>XStreamAlias</em>:</p> <pre><code>@XStreamAlias("ProvaPojo") public class ProvaPojo implements Serializable { private static final long serialVersionUID = 1687248536279612587L; @XStreamAlias("fieldOne") private int fieldOne; @XStreamAlias("fieldTwo") private String fieldTwo; public int getFieldOne() { return fieldOne; } public void setFieldOne(int fieldOne) { this.fieldOne = fieldOne; } public String getFieldTwo() { return fieldTwo; } public void setFieldTwo(String fieldTwo) { this.fieldTwo = fieldTwo; } } </code></pre> <p>And this is my PHP code (original example is <a href="" rel="nofollow">here</a>):</p> <pre><code>$body = array( 'ProvaPojo' =&gt; array( array('fieldOne' =&gt; 14), array('fieldTwo' =&gt; 'Stringa') ) ); $header = array(); $header['transformation'] = 'jms-map-json'; $mapMessage = new StompMessageMap($body, $header); $con-&gt;send($queue, $mapMessage); </code></pre> <p>And this is my listener</p> <pre><code>@Override protected void _onMessage(Message message) { if (!(message instanceof ObjectMessage)) throw new IllegalStateException(); ObjectMessage objectMessage = (ObjectMessage) message; try { if (!(objectMessage.getObject() instanceof BlacklisterRecipientBean)) throw new IllegalArgumentException( "The message content is not an instance of " + BlacklisterRecipientBean.class.getSimpleName()); BlacklisterRecipientBean recipient = (BlacklisterRecipientBean) objectMessage .getObject();"_onMessage(Message)"); IncomingBlacklistAddJMSTrigger trigger = new IncomingBlacklistAddJMSTrigger(); trigger.setArgs(recipient); notifyObservers(trigger); } catch (JMSException e) { log.error("_onMessage(Message) - exception ignored", e); } } </code></pre> <p>But I'm always getting an ActiveMQTextMessage. What am I missing?</p> </div>




javax.jms.JMSException: java.lang.NullPointerException at org.apache.activemq.util.JMSExceptionSupport.create( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.ActiveMQConnection.syncSendPacket( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.ActiveMQConnection.start( ~[activemq-all-5.4.2.jar:5.4.2] at ~[catt-pub-net.jar:na] at ~[catt-pub-net.jar:na] at ~[catt-pub-net.jar:na] at ~[catt-pub-net.jar:na] at [JMSCollectModule-] at [JMSCollectModule-] at com.catt.zhwg.jms.ManageThread.launch( [JMSCollectModule-] at com.catt.zhwg.jms.utils.swing.Console.start( [JMSCollectModule-] at com.catt.zhwg.jms.utils.swing.Console.start( [JMSCollectModule-] at com.catt.zhwg.jms.utils.swing.SwingMain.main( [JMSCollectModule-] java.lang.NullPointerException: null at ~[na:na] at ~[activemq-all-5.4.2.jar:5.4.2] at ~[activemq-all-5.4.2.jar:5.4.2] at ~[activemq-all-5.4.2.jar:5.4.2] at ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.command.ConnectionInfo.visit( ~[activemq-all-5.4.2.jar:5.4.2] at ~[activemq-all-5.4.2.jar:5.4.2] at$1.onCommand( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.transport.MutexTransport.onCommand( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.transport.WireFormatNegotiator.onCommand( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand( ~[na:na] at org.apache.activemq.transport.TransportSupport.doConsume( ~[activemq-all-5.4.2.jar:5.4.2] at org.apache.activemq.transport.tcp.TcpTransport.doRun( ~[activemq-all-5.4.2.jar:5.4.2] at ~[activemq-all-5.4.2.jar:5.4.2] at Source) ~[na:1.6.0_23]


用ajax调用activemq需要在web服务端配置AjaxServlet,问题是开发语言是php, 应该怎么配置?还有stomp又是怎么一回事?望大神解救~~

stomp-> hasFrame()返回false,队列中包含消息

<div class="post-text" itemprop="text"> <p>When consuming data from a ActiveMQ queue im running into the following problem</p> <p>With the following code:</p> <pre><code>$stomp = new Stomp($activeMQURI); $stomp-&gt;subscribe($queue); while ($stomp-&gt;hasFrame()) { $frame = $stomp-&gt;readFrame(); if ($frame) { $stomp-&gt;ack($frame); } } </code></pre> <p>It will only loop through about 1-10 messages before $stomp-&gt;hasFrame() returns false. The problem is there are 10k messages still in the queue!</p> <p>When i put a delay in after the acknowledgment everything works as expected: </p> <pre><code>$stomp = new Stomp($activeMQURI); $stomp-&gt;subscribe($queue); while ($stomp-&gt;hasFrame()) { $frame = $stomp-&gt;readFrame(); if ($frame) { $stomp-&gt;ack($frame); sleep(1); } } </code></pre> <p>I was thinking that this was happening because the ActiveMQ server has not had a chance to process the ack before the consumer (my code) requests another frame. Can anyone explain the real reason why this is happening, and maybe a better fix then SLEEP?</p> </div>


做毕设在前端使用stomp创建了sender(生产消息)和listener(监听消息),为了保持数据最新,我设置了10秒的定时器每过一会就调用一次sender发送消息去后端请求数据,再通过listener接收后端传回的数据。 但是我发现每次调用sender都会创建一个connection(通过activemq后台查看的),如图(可以看到有很多个连接了): ![图片说明]( 所以怎么样能让连接可以多次使用?或者保证我的连接数量不这样每发一次消息就增加一个连接?


<div class="post-text" itemprop="text"> <p>Try subscribing ActiveMQ(Apollo) using Go-Stomp, but I am having read timeout error. My app should be alive 24 hours per day to process incoming message.</p> <p><strong>Question</strong> : </p> <ol> <li>Is there a way to keep the subcription although there is no more message exist in the queue? Trying to put ConnOpt.HeartBeat also does not seems to work</li> <li>Why after the readTimeout, it seems that I still accept one more message ?</li> </ol> <p>Below is my steps :</p> <ul> <li>I put 1000 messages for testing in the inputQueue </li> <li>Run a subscriber, code provided below </li> <li>Subscriber finished reading 1000 messages After 2-3 seconds, saw error " 2016/10/07 17:12:44 Subscription 1: /queue/hflc-in: ERROR message:read timeout". </li> <li>Put another 1000 messages, but it seems the subscription is already down, therefore no message is not being processed</li> </ul> <p>My Code :</p> <pre><code> var( serverAddr = flag.String("server", "", "STOMP server endpoint") messageCount = flag.Int("count", 10, "Number of messages to send/receive") inputQ = flag.String("inputq", "/queue/hflc-in", "Input queue") ) var options []func(*stomp.Conn) error = []func(*stomp.Conn) error{ stomp.ConnOpt.Login("userid", "userpassword"), stomp.ConnOpt.Host("mybroker"), stomp.ConnOpt.HeartBeat(360*time.Second, 360*time.Second), // I put this but seems no impact } func main() { flag.Parse() jobschan := make(chan bean.Request, 10) //my init setup go getInput(1, jobschan) } func getInput(id int, jobschan chan bean.Request) { conn, err := stomp.Dial("tcp", *serverAddr, options...) if err != nil { println("cannot connect to server", err.Error()) return } fmt.Printf("Connected %v ", id) sub, err := conn.Subscribe(*inputQ, stomp.AckClient) if err != nil { println("cannot subscribe to", *inputQ, err.Error()) return } fmt.Printf("Subscribed %v ", id) var messageCount int for { msg := &lt;-sub.C //expectedText := fmt.Sprintf("Message #%d", i) if msg != nil { actualText := string(msg.Body) var req bean.Request if actualText != "SHUTDOWN" { messageCount = messageCount + 1 var err2 = easyjson.Unmarshal([]byte(actualText), &amp;req) if err2 != nil { log.Error("Unable unmarshall", zap.Error(err)) println("message body %v", msg.Body) // what is [0/0]0x0 ? } else { fmt.Printf("Subscriber %v received message, count %v ", id, messageCount) jobschan &lt;- req } } else { logchan &lt;- "got some issue" } } } } </code></pre> <p>Error :</p> <blockquote> <p>2016/10/07 17:12:44 Subscription 1: /queue/hflc-in: ERROR message:read timeout<br> [E] 2016-10-07T09:12:44Z Unable unmarshall<br> message body %v [0/0]0x0 </p> </blockquote> </div>


<div class="post-text" itemprop="text"> <p>I do get ActiveMQ supports data persistence (<a href="" rel="nofollow noreferrer"></a>), but i cannot understand how to make it work, the result is when i restart ActiveMQ all the messages disappear, while queues and topics remain. </p> <p>I've read about to enable persistence on a database but i want to keep data on the filesystem since my system is facing database perfomance issues.</p> <p>This is my activemq.xml</p> <pre><code>&lt;!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --&gt; &lt;!-- START SNIPPET: example --&gt; &lt;beans xmlns="" xmlns:xsi="" xsi:schemaLocation=""&gt; &lt;!-- Allows us to use system properties as variables in this configuration file --&gt; &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="locations"&gt; &lt;value&gt;file:${activemq.conf}/;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;!-- Allows accessing the server log --&gt; &lt;bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery" lazy-init="false" scope="singleton" init-method="start" destroy-method="stop"&gt; &lt;/bean&gt; &lt;!-- The &lt;broker&gt; element is used to configure the ActiveMQ broker. --&gt; &lt;broker xmlns="" brokerName="localhost" dataDirectory="${}"&gt; &lt;destinationPolicy&gt; &lt;policyMap&gt; &lt;policyEntries&gt; &lt;policyEntry topic="&gt;" &gt; &lt;!-- The constantPendingMessageLimitStrategy is used to prevent slow topic consumers to block producers and affect other consumers by limiting the number of messages that are retained For more information, see: --&gt; &lt;pendingMessageLimitStrategy&gt; &lt;constantPendingMessageLimitStrategy limit="1000"/&gt; &lt;/pendingMessageLimitStrategy&gt; &lt;/policyEntry&gt; &lt;/policyEntries&gt; &lt;/policyMap&gt; &lt;/destinationPolicy&gt; &lt;!-- The managementContext is used to configure how ActiveMQ is exposed in JMX. By default, ActiveMQ uses the MBean server that is started by the JVM. For more information, see: --&gt; &lt;managementContext&gt; &lt;managementContext createConnector="false"/&gt; &lt;/managementContext&gt; &lt;!-- Configure message persistence for the broker. The default persistence mechanism is the KahaDB store (identified by the kahaDB tag). For more information, see: --&gt; &lt;persistenceAdapter&gt; &lt;kahaDB directory="${}/kahadb"/&gt; &lt;/persistenceAdapter&gt; &lt;!-- The systemUsage controls the maximum amount of space the broker will use before disabling caching and/or slowing down producers. For more information, see: --&gt; &lt;systemUsage&gt; &lt;systemUsage&gt; &lt;memoryUsage&gt; &lt;memoryUsage percentOfJvmHeap="70" /&gt; &lt;/memoryUsage&gt; &lt;storeUsage&gt; &lt;storeUsage limit="100 gb"/&gt; &lt;/storeUsage&gt; &lt;tempUsage&gt; &lt;tempUsage limit="50 gb"/&gt; &lt;/tempUsage&gt; &lt;/systemUsage&gt; &lt;/systemUsage&gt; &lt;!-- The transport connectors expose ActiveMQ over a given protocol to clients and other brokers. For more information, see: --&gt; &lt;transportConnectors&gt; &lt;!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB --&gt; &lt;transportConnector name="openwire" uri="tcp://;amp;wireFormat.maxFrameSize=104857600"/&gt; &lt;transportConnector name="amqp" uri="amqp://;amp;wireFormat.maxFrameSize=104857600"/&gt; &lt;transportConnector name="stomp" uri="stomp://;amp;wireFormat.maxFrameSize=104857600"/&gt; &lt;transportConnector name="mqtt" uri="mqtt://;amp;wireFormat.maxFrameSize=104857600"/&gt; &lt;transportConnector name="ws" uri="ws://;amp;wireFormat.maxFrameSize=104857600"/&gt; &lt;/transportConnectors&gt; &lt;!-- destroy the spring context on shutdown to stop jetty --&gt; &lt;shutdownHooks&gt; &lt;bean xmlns="" class="org.apache.activemq.hooks.SpringContextHook" /&gt; &lt;/shutdownHooks&gt; &lt;/broker&gt; &lt;!-- Enable web consoles, REST and Ajax APIs and demos The web consoles requires by default login, you can disable this in the jetty.xml file Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details --&gt; &lt;import resource="jetty.xml"/&gt; </code></pre> <p> </p> </div>


<div class="post-text" itemprop="text"> <p>I am using ActiveMQ to store a queue of messages.<br> I am using the PECL Stomp extension to connect to it. I am publishing to the queue successfully, and reading from it successfuly.<br> How do I configure the queue to delete a message after I consumed it?<br> In my listener, I use</p> <pre><code>$c = new Stomp($url); $c-&gt;subscribe('/queue/something'); echo $c-&gt;readFrame(); </code></pre> </div>


<div class="post-text" itemprop="text"> <ul> <li><strong>Brief Intro</strong></li> </ul> <p>I'm now using stomp to connect with ActiveMQ based on a PHP site running on apache server. The Stomp can run in bash but can't run in apache.</p> <ul> <li><strong>Preparation</strong></li> </ul> <p>I install stomp by </p> <pre><code>pecl install stomp </code></pre> <p>and modify the php.ini with</p> <pre><code> </code></pre> <p>I have a 'index.php' like this:</p> <pre><code>&lt;?php echo 'runing-'; /* connection */ try { $stomp = new Stomp('tcp://localhost:61613'); echo 'connecting-'; } catch(StompException $e) { die('Error! Connection failed: ' . $e-&gt;getMessage()); } $stomp-&gt;send('/queue/test', 'Hello from PHP'); echo 'finished.'; /* close connection */ unset($stomp); ?&gt; </code></pre> <ul> <li><strong>Start Working</strong></li> </ul> <p>Firstly, I run with</p> <pre><code>$ php index.php </code></pre> <p>And it echo as my expectation:</p> <pre><code>$ php index.php runing-connecting-finished. </code></pre> <p>Then I open it in browser: </p> <pre><code>http://localhost/index.php </code></pre> <p>It reports</p> <pre><code>runing-Error! Connection failed: Unable to connect to localhost:61613 </code></pre> <ul> <li><strong>Question</strong></li> </ul> <p>I've searching resolution for this error all day... I guess apache block the request from stomp since it runs successfully in bash.</p> <p>What should I do to fix this bug?</p> <p>Thanks really.</p> </div>



技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...


提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...




前言 个人觉得面试也像是一场全新的征程,失败和胜利都是平常之事。所以,劝各位不要因为面试失败而灰心、 丧失斗志。也不要因为面试通过而沾沾自喜,等待你的将是更美好的未来,继续加油! 本篇分享的面试题内容包括:Java、MyBatis、ZooKeeper、Dubbo、Elasticsearch、Redis、MySQL、Spring、SpringBoot、SpringCloud、RabbitMQ...


反正,我的抖音没人看,别人都有几十万个赞什么的。 发到CSDN上来,大家交流下~ 主要用到原生态的 JS+CSS3。 具体不解释了,看注释: &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Title&lt;/tit...


我在年前从上一家公司离职,没想到过年期间疫情爆发,我也被困在家里,在家呆着的日子让人很焦躁,于是我疯狂的投简历,看面试题,希望可以进大公司去看看。 我也有幸面试了我觉得还挺大的公司的(虽然不是bat之类的大厂,但是作为一名二本计算机专业刚毕业的大学生bat那些大厂我连投简历的勇气都没有),最后选择了中软,我知道这是一家外包公司,待遇各方面甚至不如我的上一家公司,但是对我而言这可是外包华为,能...


北京时间2020年3月27日9点整,如往常一样来到公司,带开电脑,正准备打开Github网站看一会源代码,再开始手头的工作。哟吼,一直打不开,一直出现如下页面: 我想很多网友也尝到了甜头,各大技术群炸开了锅,据网友反馈有攻击者正在发起大规模的中间人挟持,京东和Github等网站等网站都受到了影响。 什么是中间中间人挟持呢? 简而言之,就是攻击者在数据网络传输的过程中,截获传输过程中的数据并篡改...


接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?





已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...


近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...


郭一璞 发自 凹非寺量子位 报道 | 公众号 QbitAI国产手机界的两大玩家,华为&amp;小米,昨天在同一天前后脚发布了2019年财报。同行冤家,发财报也碰在了同一天。那我们就对比...


导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...


这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...


A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...


文章目录前言正文**1、Kaspersky Cyberthreat real-time map****2、Finding Home****3、Silk – Interactive Generative Art****4、Liquid Particles 3D****5、WINDOWS93****6、Staggering Beauty****7、Ostagram图片生成器网址****8、全历史网址*...




大家好,我是武哥,最近经常有小伙伴问我要电子书,都什么年代了,还找不到电子书吗?如果要说原因,那就是你还没遇到武哥我(手动滑稽~)!我今天把这么多年我经常看的电子书网站整理一下给大家,基本上能解决大家的需求。不管是在校生还是已经工作了,相信肯定对你有所帮助! 1.鸠摩搜书 首先给大家推荐的网站是:鸠摩搜书 地址: 这个网上非常棒,上面有很多优质...


前期回顾: MySQL性能优化(一):MySQL架构与核心问题 MySQL性能优化(二):选择优化的数据类型 MySQL性能优化(三):深入理解索引的这点事 MySQL性能优化(四):如何高效正确的使用索引 前面章节我们介绍了如何选择优化的数据类型、如何高效的使用索引,这些对于高性能的MySQL来说是必不可少的。但这些还完全不够,还需要合理的设计查询。如果查询写的很糟糕,即使表结构再合理、索引再...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...


不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...


某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...




小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装

疫情后北上广深租房价格跌了吗? | Alfred数据室


面试官给我挖坑:a[i][j] 和 a[j][i] 有什么区别?

点击上方“朱小厮的博客”,选择“设为星标”后台回复&#34;1024&#34;领取公众号专属资料本文以一个简单的程序开头——数组赋值:int LEN = 10000; int[][] ...


之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信