ARTEMIS-3442 Removing input for journal retention on cli create

This commit is contained in:
Clebert Suconic 2021-09-10 22:04:16 -04:00 committed by clebertsuconic
parent 5dbbc98a62
commit 6db6b8cf9e
4 changed files with 11 additions and 18 deletions

View File

@ -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.") @Option(name = "--journal-device-block-size", description = "The block size by the device, default at 4096.")
private int journalDeviceBlockSize = 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; private int retentionDays;
@Option(name = "--journal-retention-max-bytes", description = "It will be passed as storage-limit on the journal-retention-directory tag") @Option(name = "--journal-retention-max-bytes", description = "It will be passed as storage-limit on the journal-retention-directory tag")
@ -771,17 +771,20 @@ public class Create extends InputAbstract {
boolean allowAnonymous = isAllowAnonymous(); boolean allowAnonymous = isAllowAnonymous();
if (retentionDays == 0) { String retentionTag;
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 = "";
if (retentionDays > 0) { if (retentionDays > 0) {
if (retentionMaxBytes != null) { if (retentionMaxBytes != null) {
retentionTag = "<journal-retention-directory period=\"" + retentionDays + "\" unit=\"DAYS\" storage-limit=\"" + retentionMaxBytes + "\">" + data + "/retention</journal-retention-directory>"; retentionTag = "<journal-retention-directory period=\"" + retentionDays + "\" unit=\"DAYS\" storage-limit=\"" + retentionMaxBytes + "\">" + data + "/retention</journal-retention-directory>";
} else { } else {
retentionTag = "<journal-retention-directory period=\"" + retentionDays + "\" unit=\"DAYS\">" + data + "/retention</journal-retention-directory>"; 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); filters.put("${journal-retention}", retentionTag);

View File

@ -46,16 +46,6 @@ ${jdbc}
<large-messages-directory>${data.dir}/large-messages</large-messages-directory> <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-retention}
<journal-datasync>${fsync}</journal-datasync> <journal-datasync>${fsync}</journal-datasync>

View File

@ -516,6 +516,6 @@ public interface ActiveMQMessageBundle {
@Message(id = 229238, value = "No target to redirect the connection") @Message(id = 229238, value = "No target to redirect the connection")
ActiveMQRedirectedException cannotRedirect(); 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(); IllegalArgumentException noRetention();
} }

View File

@ -1224,7 +1224,7 @@
<!-- this is needed to run the server remotely --> <!-- this is needed to run the server remotely -->
<arg>--java-options</arg> <arg>--java-options</arg>
<arg>-Djava.rmi.server.hostname=localhost</arg> <arg>-Djava.rmi.server.hostname=localhost</arg>
<arg>--journal-retention-days</arg> <arg>--journal-retention</arg>
<arg>1</arg> <arg>1</arg>
<arg>--queues</arg> <arg>--queues</arg>
<arg>RetentionTest</arg> <arg>RetentionTest</arg>