buildCommand method

  1. @override
String buildCommand()
override

Build the @ command to be sent to remote secondary for execution.

Implementation

@override
String buildCommand() {
  StringBuffer sb = StringBuffer();
  sb.write('notify:id:$id');

  if (operation != null) {
    sb.write(':${getOperationName(operation)}');
  }
  if (messageType != null) {
    sb.write(':messageType:${getMessageType(messageType)}');
  }
  if (priority != null) {
    sb.write(':priority:${getPriority(priority)}');
  }
  if (strategy != null) {
    sb.write(':strategy:${getStrategy(strategy)}');
  }
  if (latestN != null) {
    sb.write(':latestN:$latestN');
  }
  sb.write(':notifier:$notifier');
  if (ttln != null) {
    sb.write(':ttln:$ttln');
  }

  // Add in all of the metadata parameters in atProtocol command format
  sb.write(_toAtProtocolFragment(atKey.metadata));

  if (atKey.sharedWith != null) {
    sb.write(':${VerbUtil.formatAtSign(atKey.sharedWith)}');
  }

  if (atKey.metadata.isPublic == true) {
    sb.write(':public');
  }
  sb.write(':${atKey.key}');

  if (atKey.sharedBy != null) {
    sb.write('${VerbUtil.formatAtSign(atKey.sharedBy)}');
  }
  if (value != null) {
    sb.write(':$value');
  }

  sb.write('\n');

  return sb.toString();
}