Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F3BAD200D28 for ; Thu, 14 Sep 2017 21:48:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F38441609CD; Thu, 14 Sep 2017 19:48:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1EC221609E5 for ; Thu, 14 Sep 2017 21:48:23 +0200 (CEST) Received: (qmail 2573 invoked by uid 500); 14 Sep 2017 19:48:23 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 1340 invoked by uid 99); 14 Sep 2017 19:48:22 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 19:48:22 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 63C083A0D74 for ; Thu, 14 Sep 2017 19:48:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1018163 [27/45] - in /websites/production/activemq/content/artemis/docs: 2.2.0/ latest/ latest/diagrams/ latest/gitbook/ latest/gitbook/fonts/ latest/gitbook/fonts/fontawesome/ latest/gitbook/gitbook-plugin-fontsettings/ latest/gitbook/git... Date: Thu, 14 Sep 2017 19:48:13 -0000 To: commits@activemq.apache.org From: clebertsuconic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170914194818.63C083A0D74@svn01-us-west.apache.org> archived-at: Thu, 14 Sep 2017 19:48:27 -0000 Added: websites/production/activemq/content/artemis/docs/latest/maven-plugin.html ============================================================================== --- websites/production/activemq/content/artemis/docs/latest/maven-plugin.html (added) +++ websites/production/activemq/content/artemis/docs/latest/maven-plugin.html Thu Sep 14 19:48:11 2017 @@ -0,0 +1,1300 @@ + + + + + Maven Plugin · ActiveMQ Artemis Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ +
+ +
+ + + + + + + + +
+
+ +
+
+ +
+ +

Maven Plugins

+

Since Artemis 1.1.0 Artemis provides the possibility of using Maven Plugins to manage the life cycle of servers.

+

When to use it

+

These Maven plugins were initially created to manage server instances across our examples. They can create a server, start, and do any CLI operation over servers.

+

You could for example use these maven plugins on your testsuite or deployment automation.

+

Goals

+

There are three goals that you can use

+
    +
  • create
  • +
+

This will create a server accordingly to your arguments. You can do some extra tricks here such as installing extra libraries for external modules.

+
    +
  • cli
  • +
+

This will perform any CLI operation. This is basically a maven expression of the CLI classes

+
    +
  • runClient
  • +
+

This is a simple wrapper around classes implementing a static main call. Notice that this won't spawn a new VM or new Thread.

+

Declaration

+

On your pom, use the plugins section:

+
   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+
+

create goal

+

I won't detail every operation of the create plugin here, but I will try to describe the main parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
configurationA place that will hold any file to replace on the configuration. For instance if you are providing your own broker.xml. Default is "${basedir}/target/classes/activemq/server0"
homeThe location where you downloaded and installed artemis. Default is "${activemq.basedir}"
alternateHomeThis is used case you have two possible locations for your home (e.g. one under compile and one under production
instanceWhere the server is going to be installed. Default is "${basedir}/target/server0"
liblist[]A list of libraries to be installed under ./lib. ex: "org.jgroups:jgroups:3.6.0.Final"
+

Example:

+
<executions>
+   <execution>
+      <id>create</id>
+      <goals>
+         <goal>create</goal>
+      </goals>
+      <configuration>
+         <ignore>${noServer}</ignore>
+      </configuration>
+   </execution>
+
+

cli goal

+

Some properties for the CLI

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
configurationA place that will hold any file to replace on the configuration. For instance if you are providing your own broker.xml. Default is "${basedir}/target/classes/activemq/server0"
homeThe location where you downloaded and installed artemis. Default is "${activemq.basedir}"
alternateHomeThis is used case you have two possible locations for your home (e.g. one under compile and one under production
instanceWhere the server is going to be installed. Default is "${basedir}/target/server0"
+

Similarly to the create plugin, the artemis exampels are using the cli plugin. Look at them for concrete examples.

+

Example:

+
<execution>
+  <id>start</id>
+  <goals>
+     <goal>cli</goal>
+  </goals>
+  <configuration>
+     <spawn>true</spawn>
+     <ignore>${noServer}</ignore>
+     <testURI>tcp://localhost:61616</testURI>
+     <args>
+        <param>run</param>
+     </args>
+  </configuration>
+</execution>
+
+

runClient goal

+

This is a simple solution for running classes implementing the main method.

+ + + + + + + + + + + + + + + + + +
NameDescription
clientClassA class implement a static void main(String arg[])
argsA string array of arguments passed to the method
+

Example:

+
<execution>
+  <id>runClient</id>
+  <goals>
+     <goal>runClient</goal>
+  </goals>
+  <configuration>
+     <clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
+  </configuration>
+</execution>
+
+

Complete example

+

The following example is a copy of the /examples/features/standard/queue example. You may refer to it directly under the examples directory tree.

+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+   <parent>
+      <groupId>org.apache.activemq.examples.broker</groupId>
+      <artifactId>jms-examples</artifactId>
+      <version>1.1.0</version>
+   </parent>
+
+   <artifactId>queue</artifactId>
+   <packaging>jar</packaging>
+   <name>ActiveMQ Artemis JMS Queue Example</name>
+
+   <properties>
+      <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
+   </properties>
+
+   <dependencies>
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-jms-client</artifactId>
+         <version>${project.version}</version>
+      </dependency>
+   </dependencies>
+
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>artemis-maven-plugin</artifactId>
+            <executions>
+               <execution>
+                  <id>create</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>start</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <spawn>true</spawn>
+                     <ignore>${noServer}</ignore>
+                     <testURI>tcp://localhost:61616</testURI>
+                     <args>
+                        <param>run</param>
+                     </args>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>runClient</id>
+                  <goals>
+                     <goal>runClient</goal>
+                  </goals>
+                  <configuration>
+                     <clientClass>org.apache.activemq.artemis.jms.example.QueueExample</clientClass>
+                  </configuration>
+               </execution>
+               <execution>
+                  <id>stop</id>
+                  <goals>
+                     <goal>cli</goal>
+                  </goals>
+                  <configuration>
+                     <ignore>${noServer}</ignore>
+                     <args>
+                        <param>stop</param>
+                     </args>
+                  </configuration>
+               </execution>
+            </executions>
+            <dependencies>
+               <dependency>
+                  <groupId>org.apache.activemq.examples.broker</groupId>
+                  <artifactId>queue</artifactId>
+                  <version>${project.version}</version>
+               </dependency>
+            </dependencies>
+         </plugin>
+      </plugins>
+   </build>
+
+</project>
+
+ + +
+ +
+
+
+ +

results matching ""

+
    + +
    +
    + +

    No results matching ""

    + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: websites/production/activemq/content/artemis/docs/latest/message-expiry.html ============================================================================== --- websites/production/activemq/content/artemis/docs/latest/message-expiry.html (added) +++ websites/production/activemq/content/artemis/docs/latest/message-expiry.html Thu Sep 14 19:48:11 2017 @@ -0,0 +1,1121 @@ + + + + + Message Expiry · ActiveMQ Artemis Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + +
    + +
    + +
    + + + + + + + + +
    +
    + +
    +
    + +
    + +

    Message Expiry

    +

    Messages can be set with an optional time to live when sending them.

    +

    Apache ActiveMQ Artemis will not deliver a message to a consumer after it's time to +live has been exceeded. If the message hasn't been delivered by the time +that time to live is reached the server can discard it.

    +

    Apache ActiveMQ Artemis's addresses can be assigned a expiry address so that, when +messages are expired, they are removed from the queue and sent to the +expiry address. Many different queues can be bound to an expiry address. +These expired messages can later be consumed for further inspection.

    +

    Message Expiry

    +

    Using Apache ActiveMQ Artemis Core API, you can set an expiration time directly on the +message:

    +
    // message will expire in 5000ms from now
    +message.setExpiration(System.currentTimeMillis() + 5000);
    +

    JMS MessageProducer allows to set a TimeToLive for the messages it sent:

    +
    // messages sent by this producer will be retained for 5s (5000ms) before expiration
    +producer.setTimeToLive(5000);
    +

    Expired messages which are consumed from an expiry address have the +following properties:

    +
      +
    • _AMQ_ORIG_ADDRESS

      +

      a String property containing the original address of the expired +message

      +
    • +
    • _AMQ_ORIG_QUEUE

      +

      a String property containing the original queue of the expired +message

      +
    • +
    • _AMQ_ACTUAL_EXPIRY

      +

      a Long property containing the actual expiration time of the +expired message

      +
    • +
    +

    Configuring Expiry Addresses

    +

    Expiry address are defined in the address-setting configuration:

    +
    <!-- expired messages in exampleQueue will be sent to the expiry address expiryQueue -->
    +<address-setting match="exampleQueue">
    +   <expiry-address>expiryQueue</expiry-address>
    +</address-setting>
    +

    If messages are expired and no expiry address is specified, messages are +simply removed from the queue and dropped. Address wildcards can be used +to configure expiry address for a set of addresses (see Understanding the Wildcard Syntax).

    +

    Configuring The Expiry Reaper Thread

    +

    A reaper thread will periodically inspect the queues to check if +messages have expired.

    +

    The reaper thread can be configured with the following properties in +broker.xml

    +
      +
    • message-expiry-scan-period

      +

      How often the queues will be scanned to detect expired messages (in +milliseconds, default is 30000ms, set to -1 to disable the reaper +thread)

      +
    • +
    • message-expiry-thread-priority

      +

      The reaper thread priority (it must be between 1 and 10, 10 being the +highest priority, default is 3)

      +
    • +
    +

    Example

    +

    See the examples.md chapter for an example which shows how message expiry is configured and used with JMS.

    + + +
    + +
    +
    +
    + +

    results matching ""

    +
      + +
      +
      + +

      No results matching ""

      + +
      +
      +
      + +
      +
      + +
      + + + + + + + + + + + + + + +
      + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +