Skip to content

Commit

Permalink
ARTEMIS-3442 Removing input for journal retention on cli create
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Sep 13, 2021
1 parent 5dbbc98 commit 6db6b8c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
Expand Up @@ -277,7 +277,7 @@ public class Create extends InputAbstract {
@Option(name = "--journal-device-block-size", description = "The block size by the device, default at 4096.")
private int journalDeviceBlockSize = 4096;

@Option(name = "--journal-retention-days", description = "If > 0, It will enable journal-retention-directory on the broker.xml allowing replay options. This option will configure retention in days.")
@Option(name = "--journal-retention", description = "If > 0, It will enable journal-retention-directory on the broker.xml allowing replay options. This option will configure retention in days.")
private int retentionDays;

@Option(name = "--journal-retention-max-bytes", description = "It will be passed as storage-limit on the journal-retention-directory tag")
Expand Down Expand Up @@ -771,17 +771,20 @@ public Object run(ActionContext context) throws Exception {
boolean allowAnonymous = isAllowAnonymous();


if (retentionDays == 0) {
retentionDays = inputInteger("--journal-retention-days", "How many days you would like to keep retained in the journal? Use 0 for no retention.", "0");
}

String retentionTag = "";
String retentionTag;
if (retentionDays > 0) {
if (retentionMaxBytes != null) {
retentionTag = "<journal-retention-directory period=\"" + retentionDays + "\" unit=\"DAYS\" storage-limit=\"" + retentionMaxBytes + "\">" + data + "/retention</journal-retention-directory>";
} else {
retentionTag = "<journal-retention-directory period=\"" + retentionDays + "\" unit=\"DAYS\">" + data + "/retention</journal-retention-directory>";
}
} else {
retentionTag = "\n" +
" <!-- if you want to retain your journal uncomment this following configuration.\n\n" +
" This will allow your system to keep 7 days of your data, up to 10G. Tweak it accordingly to your use case and capacity.\n\n" +
" it is recommended to use a separate storage unit from the journal for performance considerations.\n\n" +
" <journal-retention-directory period=\"7\" unit=\"DAYS\" storage-limit=\"10G\">data/retention</journal-retention-directory>\n\n" +
" Or you can also create your broker using the argument on the journal-retention on the artemis create command -->\n\n";
}

filters.put("${journal-retention}", retentionTag);
Expand Down
Expand Up @@ -46,16 +46,6 @@ ${jdbc}

<large-messages-directory>${data.dir}/large-messages</large-messages-directory>

<!--
if you want to retain your journal uncomment this following configuration.
This will allow your system to keep 7 days of your data, up to 10G. Tweak it accordingly to your use case and capacity.
it is recommended to use a separate storage unit from the journal for performance considerations.
<journal-retention-directory period="7" unit="DAYS" storage-limit="10G">data/retention</journal-retention-directory>
-->

${journal-retention}

<journal-datasync>${fsync}</journal-datasync>
Expand Down
Expand Up @@ -516,6 +516,6 @@ IllegalStateException invalidRoutingTypeUpdate(String queueName,
@Message(id = 229238, value = "No target to redirect the connection")
ActiveMQRedirectedException cannotRedirect();

@Message(id = 229239, value = "There is not retention configured. In order to use the replay method you must specify journal-retention-directory element on the broker.xml")
@Message(id = 229239, value = "There is no retention configured. In order to use the replay method you must specify journal-retention-directory element on the broker.xml")
IllegalArgumentException noRetention();
}
2 changes: 1 addition & 1 deletion tests/smoke-tests/pom.xml
Expand Up @@ -1224,7 +1224,7 @@
<!-- this is needed to run the server remotely -->
<arg>--java-options</arg>
<arg>-Djava.rmi.server.hostname=localhost</arg>
<arg>--journal-retention-days</arg>
<arg>--journal-retention</arg>
<arg>1</arg>
<arg>--queues</arg>
<arg>RetentionTest</arg>
Expand Down

0 comments on commit 6db6b8c

Please sign in to comment.