{"record":{"id":"aa4b00fa10689926","repo":"apache/beam","slug":"solaceio-write-unknown-destination-type-destination-gettype","errorCode":null,"errorMessage":"SolaceIO.Write: Unknown destination type: ${destination.getType()}","messagePattern":"SolaceIO\\.Write: Unknown destination type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/SolaceIO.java","lineNumber":457,"sourceCode":"  /** Get a {@link Queue} object from the queue name. */\n  static Queue queueFromName(String queueName) {\n    return JCSMPFactory.onlyInstance().createQueue(queueName);\n  }\n\n  /**\n   * Convert to a JCSMP destination from a schema-enabled {@link\n   * org.apache.beam.sdk.io.solace.data.Solace.Destination}.\n   *\n   * <p>This method returns a {@link Destination}, which may be either a {@link Topic} or a {@link\n   * Queue}\n   */\n  public static Destination convertToJcsmpDestination(Solace.Destination destination) {\n    if (destination.getType().equals(Solace.DestinationType.TOPIC)) {\n      return topicFromName(checkNotNull(destination.getName()));\n    } else if (destination.getType().equals(Solace.DestinationType.QUEUE)) {\n      return queueFromName(checkNotNull(destination.getName()));\n    } else {\n      throw new IllegalArgumentException(\n          \"SolaceIO.Write: Unknown destination type: \" + destination.getType());\n    }\n  }\n\n  /**\n   * Create a {@link Read} transform, to read from Solace. The ingested records will be mapped to\n   * the {@link Solace.Record} objects.\n   */\n  public static Read<Solace.Record> read() {\n    return new Read<Solace.Record>(\n        Read.Configuration.<Solace.Record>builder()\n            .setTypeDescriptor(TypeDescriptor.of(Solace.Record.class))\n            .setParseFn(SolaceRecordMapper::toRecord)\n            .setTimestampFn(SENDER_TIMESTAMP_FUNCTION)\n            .setDeduplicateRecords(DEFAULT_DEDUPLICATE_RECORDS)\n            .setWatermarkIdleDurationThreshold(DEFAULT_WATERMARK_IDLE_DURATION_THRESHOLD)\n            .setAckDeadline(DEFAULT_ACK_DEADLINE)\n            .setNackOnTimeout(DEFAULT_NACK_ON_TIMEOUT));","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/SolaceIO.java#L439-L475","documentation":"SolaceIO.Write's convertToJcsmpDestination only maps TOPIC and QUEUE destination types; any other Solace.DestinationType throws this IllegalArgumentException. It is a defensive check that every destination the writer emits is one JCSMP can represent.","triggerScenarios":"A custom Solace.Destination whose getType() is not TOPIC or QUEUE is supplied to SolaceIO.Write (custom destination mappings / subclassed Destination), reaching convertToJcsmpDestination during message serialization.","commonSituations":"Implementing a custom Destination with an invented type (e.g. TEMPORARY_TOPIC) unsupported by Beam's Solace writer; mapping library version mismatch returning an unexpected enum value.","solutions":["Return Solace.DestinationType.TOPIC or QUEUE from your Destination implementation.","In your custom mapping, build a topic-only Destination: use Solace.DestinationType.TOPIC with the topic name.","Check the version of the solace mapping classes matches the Beam SolaceIO version you use.","If a temporary destination is needed, create it via the JCSMP session directly instead of the generic Destination mapping."],"exampleFix":"// before\npublic Solace.DestinationType getType() { return Solace.DestinationType.TEMPORARY_QUEUE; }\n// after\npublic Solace.DestinationType getType() { return Solace.DestinationType.QUEUE; }","handlingStrategy":"type-guard","validationCode":"// Validate destination types before submitting the write\n// if (dest.getType() != Solace.DestinationType.TOPIC && dest.getType() != Solace.DestinationType.QUEUE)\n//   throw new IllegalArgumentException(\"Unsupported destination type: \" + dest.getType());","typeGuard":"boolean isWritableDestination(Solace.Destination d) {\n  return d != null && (d.getType() == Solace.DestinationType.TOPIC || d.getType() == Solace.DestinationType.QUEUE);\n}","tryCatchPattern":"try { pipeline.run(); }\ncatch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"SolaceIO.Write: Unknown destination type\")) fixDestinationMapping();\n  else throw e;\n}","preventionTips":["Only ever return TOPIC or QUEUE from custom Destination.getType() implementations.","Unit-test custom destination mappings against SolaceIO before running the pipeline.","Keep Beam's SolaceIO and the Solace mapping library versions aligned."],"tags":["solace","invalid-enum-value","destination","write-path"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}