or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

connection-pooling.mdembedded-broker.mdindex.mdjms-client.mdmanagement-monitoring.mdmessages-destinations.mdnetwork-clustering.mdpersistence-storage.mdsecurity.mdspring-integration.mdtransport-protocols.md

index.mddocs/

0

# Apache ActiveMQ All JAR Bundle

1

2

Apache ActiveMQ All JAR Bundle is a comprehensive, single-JAR deployment of the Apache ActiveMQ message broker that aggregates all ActiveMQ modules into one artifact. It provides a complete messaging solution supporting JMS 1.1/2.0, multiple transport protocols (STOMP, AMQP, MQTT, HTTP), persistent storage options, enterprise security, Spring integration, and embedded broker capabilities.

3

4

## Package Information

5

6

- **Package Name**: org.apache.activemq:activemq-all

7

- **Package Type**: maven

8

- **Language**: Java

9

- **Installation**: Add to Maven dependencies or download JAR directly

10

- **Version**: 6.1.7

11

12

```xml

13

<dependency>

14

<groupId>org.apache.activemq</groupId>

15

<artifactId>activemq-all</artifactId>

16

<version>6.1.7</version>

17

</dependency>

18

```

19

20

## Core Imports

21

22

```java

23

// Core JMS client classes

24

import org.apache.activemq.ActiveMQConnectionFactory;

25

import org.apache.activemq.ActiveMQXAConnectionFactory;

26

import org.apache.activemq.ActiveMQConnection;

27

import org.apache.activemq.ActiveMQSession;

28

29

// Message types

30

import org.apache.activemq.command.ActiveMQTextMessage;

31

import org.apache.activemq.command.ActiveMQQueue;

32

import org.apache.activemq.command.ActiveMQTopic;

33

34

// Embedded broker

35

import org.apache.activemq.broker.BrokerService;

36

import org.apache.activemq.broker.BrokerFactory;

37

38

// XA Transaction support

39

import jakarta.jms.XAConnectionFactory;

40

import jakarta.jms.XAConnection;

41

import jakarta.jms.XAJMSContext;

42

43

// Spring integration

44

import org.apache.activemq.spring.ActiveMQConnectionFactory;

45

import org.apache.activemq.xbean.XBeanBrokerFactory;

46

```

47

48

## Basic Usage

49

50

### Simple Message Producer and Consumer

51

52

```java

53

import org.apache.activemq.ActiveMQConnectionFactory;

54

import org.apache.activemq.command.ActiveMQQueue;

55

import jakarta.jms.*;

56

57

// Create connection factory

58

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");

59

Connection connection = connectionFactory.createConnection();

60

connection.start();

61

62

// Create session and destination

63

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

64

Destination destination = new ActiveMQQueue("example.queue");

65

66

// Send a message

67

MessageProducer producer = session.createProducer(destination);

68

TextMessage message = session.createTextMessage("Hello ActiveMQ!");

69

producer.send(message);

70

71

// Receive a message

72

MessageConsumer consumer = session.createConsumer(destination);

73

Message receivedMessage = consumer.receive(1000);

74

75

// Clean up

76

connection.close();

77

```

78

79

### Embedded Broker

80

81

```java

82

import org.apache.activemq.broker.BrokerService;

83

84

// Create and start embedded broker

85

BrokerService broker = new BrokerService();

86

broker.setBrokerName("embedded-broker");

87

broker.addConnector("tcp://localhost:61616");

88

broker.setPersistent(false); // Use memory storage

89

broker.start();

90

91

// Use the broker...

92

93

// Stop broker

94

broker.stop();

95

```

96

97

### JMS 2.0 Context API Usage

98

99

```java

100

import org.apache.activemq.ActiveMQConnectionFactory;

101

import jakarta.jms.*;

102

103

// Create JMS 2.0 context (simpler than traditional JMS 1.1)

104

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");

105

106

try (JMSContext context = connectionFactory.createContext()) {

107

// Create destination and producer

108

Queue queue = context.createQueue("example.queue");

109

JMSProducer producer = context.createProducer();

110

111

// Send message

112

producer.send(queue, "Hello from JMS 2.0!");

113

114

// Create consumer and receive message

115

JMSConsumer consumer = context.createConsumer(queue);

116

String message = consumer.receiveBody(String.class, 1000);

117

118

System.out.println("Received: " + message);

119

}

120

```

121

122

## Architecture

123

124

Apache ActiveMQ All JAR Bundle is built around several key architectural components:

125

126

- **JMS Implementation**: Complete JMS 1.1 and JMS 2.0 API implementation with connection factories, sessions, producers, consumers, and all message types

127

- **Transport Layer**: Pluggable transport system supporting TCP, SSL, HTTP, STOMP, AMQP, MQTT protocols with auto-detection capabilities

128

- **Broker Engine**: Embeddable broker service with message routing, destination management, and plugin architecture

129

- **Persistence Layer**: Multiple storage options including high-performance KahaDB, JDBC databases, and in-memory storage

130

- **Security Framework**: JAAS and Apache Shiro integration for authentication and authorization

131

- **Connection Pooling**: Enterprise-grade connection pooling for high-throughput applications

132

- **Network Clustering**: Multi-broker networks with automatic discovery and load balancing

133

- **Management Layer**: JMX-based monitoring and administration with web console

134

- **Spring Integration**: First-class Spring Framework support with XML configuration and dependency injection

135

136

## Capabilities

137

138

### JMS Client Implementation

139

140

Core JMS client functionality for connecting to ActiveMQ brokers and performing messaging operations.

141

142

```java { .api }

143

// Primary connection factory

144

public class ActiveMQConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory {

145

public ActiveMQConnectionFactory();

146

public ActiveMQConnectionFactory(String brokerURL);

147

public Connection createConnection() throws JMSException;

148

public Connection createConnection(String userName, String password) throws JMSException;

149

public void setBrokerURL(String brokerURL);

150

public String getBrokerURL();

151

}

152

153

// XA transaction-enabled connection factory

154

public class ActiveMQXAConnectionFactory extends ActiveMQConnectionFactory implements XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory {

155

public ActiveMQXAConnectionFactory();

156

public ActiveMQXAConnectionFactory(String brokerURL);

157

public ActiveMQXAConnectionFactory(String userName, String password, String brokerURL);

158

public XAConnection createXAConnection() throws JMSException;

159

public XAConnection createXAConnection(String userName, String password) throws JMSException;

160

public XAJMSContext createXAContext();

161

public XAJMSContext createXAContext(String userName, String password);

162

}

163

164

// JMS 2.0 Context API

165

public class ActiveMQContext implements JMSContext {

166

public JMSProducer createProducer();

167

public JMSConsumer createConsumer(Destination destination);

168

public JMSConsumer createConsumer(Destination destination, String messageSelector);

169

public JMSConsumer createDurableConsumer(Topic topic, String name);

170

public Queue createQueue(String queueName);

171

public Topic createTopic(String topicName);

172

public TextMessage createTextMessage(String text);

173

public BytesMessage createBytesMessage();

174

public MapMessage createMapMessage();

175

public void commit() throws JMSRuntimeException;

176

public void rollback() throws JMSRuntimeException;

177

}

178

```

179

180

[JMS Client API](./jms-client.md)

181

182

### Message Types and Destinations

183

184

Complete set of JMS message types and destination implementations with ActiveMQ extensions.

185

186

```java { .api }

187

// Base message with scheduling support

188

public class ActiveMQMessage implements Message, ScheduledMessage {

189

public void setScheduledDeliveryTime(long scheduledDeliveryTime);

190

public long getScheduledDeliveryTime();

191

public void setRedeliveryDelay(long redeliveryDelay);

192

}

193

194

// Destination types

195

public class ActiveMQQueue extends ActiveMQDestination implements Queue {

196

public ActiveMQQueue(String name);

197

public String getQueueName() throws JMSException;

198

}

199

200

public class ActiveMQTopic extends ActiveMQDestination implements Topic {

201

public ActiveMQTopic(String name);

202

public String getTopicName() throws JMSException;

203

}

204

```

205

206

[Messages and Destinations](./messages-destinations.md)

207

208

### Embedded Broker

209

210

Classes for embedding ActiveMQ brokers within applications for standalone deployment.

211

212

```java { .api }

213

public class BrokerService implements Service {

214

public void start() throws Exception;

215

public void stop() throws Exception;

216

public TransportConnector addConnector(String bindAddress) throws Exception;

217

public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter);

218

public void setBrokerName(String brokerName);

219

public void setUseJmx(boolean useJmx);

220

}

221

222

public class BrokerFactory {

223

public static BrokerService createBroker(URI config) throws Exception;

224

public static BrokerService createBrokerFromURI(String uri) throws Exception;

225

}

226

```

227

228

[Embedded Broker](./embedded-broker.md)

229

230

### Transport Protocols

231

232

Support for multiple messaging protocols beyond standard JMS including STOMP, AMQP, MQTT, and HTTP.

233

234

```java { .api }

235

// STOMP protocol support

236

public interface Stomp {

237

String CONNECT = "CONNECT";

238

String SEND = "SEND";

239

String SUBSCRIBE = "SUBSCRIBE";

240

String UNSUBSCRIBE = "UNSUBSCRIBE";

241

String ACK = "ACK";

242

String NACK = "NACK";

243

}

244

245

// AMQP transport

246

public class AmqpTransport extends TransportSupport {

247

public AmqpTransport(WireFormat wireFormat, Socket socket) throws IOException;

248

}

249

```

250

251

[Transport Protocols](./transport-protocols.md)

252

253

### Persistence and Storage

254

255

Multiple persistence adapters for message storage including high-performance file-based and database storage.

256

257

```java { .api }

258

public interface PersistenceAdapter extends Service {

259

MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException;

260

TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException;

261

TransactionStore createTransactionStore() throws IOException;

262

Set<ActiveMQDestination> getDestinations();

263

}

264

265

public class KahaDBPersistenceAdapter implements PersistenceAdapter, JournaledStore {

266

public void setDirectory(File directory);

267

public void setJournalMaxFileLength(int journalMaxFileLength);

268

public void setIndexCacheSize(int indexCacheSize);

269

}

270

```

271

272

[Persistence and Storage](./persistence-storage.md)

273

274

### Security Integration

275

276

Enterprise security features including JAAS and Apache Shiro integration for authentication and authorization.

277

278

```java { .api }

279

// JAAS Login Modules

280

public class PropertiesLoginModule implements LoginModule {

281

public boolean login() throws LoginException;

282

public boolean commit() throws LoginException;

283

public void initialize(Subject subject, CallbackHandler callbackHandler,

284

Map<String,?> sharedState, Map<String,?> options);

285

}

286

287

// Shiro Integration

288

public class ShiroPlugin implements BrokerPlugin {

289

public Broker installPlugin(Broker broker) throws Exception;

290

public void setIniResourcePath(String iniResourcePath);

291

}

292

```

293

294

[Security Integration](./security.md)

295

296

### Connection Pooling

297

298

Enterprise connection pooling implementations for high-performance applications.

299

300

```java { .api }

301

// Modern pooling implementation

302

public class PooledConnectionFactory implements ConnectionFactory, JNDIStorableInterface, Service {

303

public void setConnectionFactory(ConnectionFactory connectionFactory);

304

public void setMaxConnections(int maxConnections);

305

public void setMaximumActiveSessionPerConnection(int maximumActiveSessionPerConnection);

306

public Connection createConnection() throws JMSException;

307

}

308

309

// XA-enabled pooling

310

public class JcaPooledConnectionFactory extends PooledConnectionFactory {

311

public void setTransactionManager(TransactionManager transactionManager);

312

public XAConnection createXAConnection() throws JMSException;

313

}

314

```

315

316

[Connection Pooling](./connection-pooling.md)

317

318

### Spring Framework Integration

319

320

Comprehensive Spring integration including dependency injection, XML configuration, and transaction management.

321

322

```java { .api }

323

// Spring-enhanced connection factory

324

public class ActiveMQConnectionFactory extends org.apache.activemq.ActiveMQConnectionFactory

325

implements BeanNameAware {

326

public void setBeanName(String beanName);

327

public void setUseBeanNameAsClientIdPrefix(boolean useBeanNameAsClientIdPrefix);

328

}

329

330

// Spring broker factory

331

public class BrokerFactoryBean implements FactoryBean<BrokerService>, InitializingBean,

332

DisposableBean, ApplicationContextAware {

333

public BrokerService getObject() throws Exception;

334

public void setConfig(Resource config);

335

public void start() throws Exception;

336

}

337

```

338

339

[Spring Integration](./spring-integration.md)

340

341

### Network Clustering

342

343

Multi-broker networking capabilities for scalable, distributed messaging architectures.

344

345

```java { .api }

346

public abstract class NetworkConnector extends DefaultBrokerService implements Service {

347

public void setUri(URI uri);

348

public void setDiscoveryUri(URI discoveryUri);

349

public void setDuplex(boolean duplex);

350

public void setNetworkTTL(int networkTTL);

351

}

352

353

public class DiscoveryNetworkConnector extends NetworkConnector {

354

public void setDiscoveryAgent(DiscoveryAgent discoveryAgent);

355

}

356

```

357

358

[Network Clustering](./network-clustering.md)

359

360

### Management and Monitoring

361

362

JMX-based management interfaces for monitoring broker health, performance, and configuration.

363

364

```java { .api }

365

public interface BrokerViewMBean {

366

String getBrokerId();

367

String getBrokerName();

368

long getTotalEnqueueCount();

369

long getTotalDequeueCount();

370

long getTotalConsumerCount();

371

void gc() throws Exception;

372

void resetStatistics();

373

}

374

375

public interface QueueViewMBean extends DestinationViewMBean {

376

long getQueueSize();

377

void purge() throws Exception;

378

boolean removeMessage(String messageId) throws Exception;

379

}

380

```

381

382

[Management and Monitoring](./management-monitoring.md)

383

384

## Exception Handling

385

386

ActiveMQ defines several specific exception types for different error conditions:

387

388

```java { .api }

389

public class AlreadyClosedException extends JMSException {

390

public AlreadyClosedException();

391

public AlreadyClosedException(String reason);

392

}

393

394

public class ConnectionClosedException extends IllegalStateException {

395

public ConnectionClosedException();

396

public ConnectionClosedException(String message);

397

}

398

399

public class ConnectionFailedException extends JMSException {

400

public ConnectionFailedException();

401

public ConnectionFailedException(IOException cause);

402

}

403

404

public class MaxFrameSizeExceededException extends IOException {

405

public MaxFrameSizeExceededException(String message);

406

public MaxFrameSizeExceededException(String message, Throwable cause);

407

}

408

```

409

410

## Types

411

412

```java { .api }

413

// Configuration policies

414

public class ActiveMQPrefetchPolicy implements Serializable {

415

public void setQueuePrefetch(int queuePrefetch);

416

public int getQueuePrefetch();

417

public void setTopicPrefetch(int topicPrefetch);

418

public int getTopicPrefetch();

419

public void setDurableTopicPrefetch(int durableTopicPrefetch);

420

public int getDurableTopicPrefetch();

421

}

422

423

public class RedeliveryPolicy extends DestinationMapEntry implements Cloneable, Serializable {

424

public void setMaximumRedeliveries(int maximumRedeliveries);

425

public int getMaximumRedeliveries();

426

public void setInitialRedeliveryDelay(long initialRedeliveryDelay);

427

public long getInitialRedeliveryDelay();

428

}

429

430

// Usage tracking

431

public class SystemUsage {

432

public void setStoreUsage(StoreUsage storeUsage);

433

public StoreUsage getStoreUsage();

434

public void setMemoryUsage(MemoryUsage memoryUsage);

435

public MemoryUsage getMemoryUsage();

436

}

437

```