Skip to content

Instantly share code, notes, and snippets.

View mtaylor's full-sized avatar

Martyn Taylor mtaylor

  • Bartr Technologies
View GitHub Profile
@BMRules(
rules = {@BMRule(
name = "Test Hang on Page Operations",
targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile",
targetMethod = "sync",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.critical.analyser.CriticalAnalyzerTestBase.methodHang();")})
@Test(timeout = 60000)
public void testFlushEntry() throws Exception {
sendConsumeDurableMessage();
@mtaylor
mtaylor / sexample.java
Created October 2, 2017 16:45
sexample.java
NettyTransport transport = NettyTransportFactory.createTransport("");
transport.setTransportListener(new NettyTransportListener() {
@Override
public void onData(ByteBuf incoming) {}
@Override
public void onTransportClosed() {}
@Override
public void onTransportError(Throwable cause) {}
@mtaylor
mtaylor / topic.xml
Created August 8, 2017 12:30
All addresses starting with topic/ are MULICAST
<address-settings name="topic/#">
<auto-create-adddress>true</auto-create-address>
<auto-create-queue>true</auto-create-queue>
<default-address-routing-type>MULTICAST</default-address-routing-type>
</address-settings>
<wildcard-addresses>
<enabled>true</enabled>
<delimiter>/</delimiter>
<any-words>#</any-words>
<aliases>
<alias match="foo" replace="bar">
<alias match="far" replace="car">
</aliases>
<addresses>
<address name="queue.foo.car">
<address name="queue.bar.far">
</address>
<addresses>
<address name="jms.topic.subscriptions" type="multicast">
<queues>
<queue name="q1" />
<queue name="q2" />
</queues>
</address>
<address name="jms.queue.work.tasks" type="multicast">
<queues>
<queue name="q1" />
<jms xmlns="urn:activemq:jms">
<queue name="queue1">
<durable>true</durable>
<selector string="car='red'" />
</queue>
</jms>
<addresses>
<!--==================-->
<!--= JMS Queues =-->
@mtaylor
mtaylor / tx.java
Last active September 8, 2016 14:39
public void addTransactionHandler(Coordinator coordinator, Receiver receiver) {
ProtonTransactionHandler transactionHandler = new ProtonTransactionHandler(sessionSPI);
// Start
// This could probably be static (doing it here for gist)
Coordinator resource = new Coordinator();
String capabilities = "[\"amqp:local-transactions\",\"amqp:multi-txns-per-ssn\",\"amqp:multi-ssns-per-txn\"]";
resource.setCapabilities(Symbol.getSymbol(capabilities));
// End static
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
}
}
@Override
public void handleConsumerDisconnect(ConsumerContext context) throws ActiveMQException {
final ClientConsumerInternal consumer = getConsumer(context);
if (consumer != null) {
Thread t = new Thread(new Runnable() {
@Override
@mtaylor
mtaylor / t.java
Created October 28, 2015 16:27
t.java
Thread t = new Thread(new Runnable() {
@Override
public void run() {
FutureLatch future = new FutureLatch();
sessionExecutor.execute(future);
boolean ok = future.await(ClientConsumerImpl.CLOSE_TIMEOUT_MILLISECONDS);
if (!ok) {
ActiveMQClientLogger.LOGGER.timeOutWaitingForProcessing(new Exception("trace"));
}