Fixed migration and added resend and cleanup options to demo application

This commit is contained in:
Christian Basler 2016-05-24 17:19:29 +02:00
parent 409dccd0be
commit 725d2b848e
3 changed files with 24 additions and 4 deletions

View File

@ -281,7 +281,8 @@ public class BitmessageContext {
public Property status() { public Property status() {
return new Property("status", null, return new Property("status", null,
ctx.getNetworkHandler().getNetworkStatus() ctx.getNetworkHandler().getNetworkStatus(),
new Property("unacknowledged", ctx.getMessageRepository().findMessagesToResend().size())
); );
} }

View File

@ -118,8 +118,27 @@ public class Application {
} }
private void info() { private void info() {
System.out.println(); String command;
System.out.println(ctx.status()); do {
System.out.println();
System.out.println(ctx.status());
System.out.println();
System.out.println("c) cleanup inventory");
System.out.println("r) resend unacknowledged messages");
System.out.println(COMMAND_BACK);
command = commandLine.nextCommand();
switch (command) {
case "c":
ctx.cleanup();
break;
case "r":
ctx.resendUnacknowledgedMessages();
break;
case "b":
return;
}
} while (!"b".equals(command));
} }
private void identities() { private void identities() {

View File

@ -1,4 +1,4 @@
ALTER TABLE Message ADD COLUMN ack_data BINARY(32); ALTER TABLE Message ADD COLUMN ack_data BINARY(32);
ALTER TABLE Message ADD COLUMN ttl BIGINT NOT NULL; ALTER TABLE Message ADD COLUMN ttl BIGINT NOT NULL DEFAULT 0;
ALTER TABLE Message ADD COLUMN retries INT NOT NULL DEFAULT 0; ALTER TABLE Message ADD COLUMN retries INT NOT NULL DEFAULT 0;
ALTER TABLE Message ADD COLUMN next_try BIGINT; ALTER TABLE Message ADD COLUMN next_try BIGINT;