{"record":{"id":"49d686aba1a3384e","repo":"apache/beam","slug":"solaceio-write-trying-to-create-a-batch-of-records-size-but","errorCode":null,"errorMessage":"SolaceIO.Write: Trying to create a batch of ${records.size()}, but Solace supports a maximum of ${SOLACE_BATCH_LIMIT}. The batch will likely be rejected by Solace.","messagePattern":"SolaceIO\\.Write: Trying to create a batch of (.+?), but Solace supports a maximum of (.+?)\\. The batch will likely be rejected by Solace\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/MessageProducerUtils.java","lineNumber":80,"sourceCode":"   * Create a {@link JCSMPSendMultipleEntry} array to be published in Solace. This can be used with\n   * `sendMultiple` to send all the messages in a single API call.\n   *\n   * <p>The size of the list cannot be larger than 50 messages. This is a hard limit enforced by the\n   * Solace API.\n   *\n   * @param records A {@link List} of records to be published\n   * @param useCorrelationKeyLatency Whether to use a complex key for tracking latency.\n   * @param destinationFn A function that maps every record to its destination.\n   * @param deliveryMode The {@link DeliveryMode} used to publish the message.\n   * @return A {@link JCSMPSendMultipleEntry} array that can be sent to Solace \"as is\".\n   */\n  public static JCSMPSendMultipleEntry[] createJCSMPSendMultipleEntry(\n      List<Solace.Record> records,\n      boolean useCorrelationKeyLatency,\n      SerializableFunction<Solace.Record, Destination> destinationFn,\n      DeliveryMode deliveryMode) {\n    if (records.size() > SOLACE_BATCH_LIMIT) {\n      throw new RuntimeException(\n          String.format(\n              \"SolaceIO.Write: Trying to create a batch of %d, but Solace supports a\"\n                  + \" maximum of %d. The batch will likely be rejected by Solace.\",\n              records.size(), SOLACE_BATCH_LIMIT));\n    }\n\n    JCSMPSendMultipleEntry[] entries = new JCSMPSendMultipleEntry[records.size()];\n    for (int i = 0; i < records.size(); i++) {\n      Solace.Record record = records.get(i);\n      JCSMPSendMultipleEntry entry =\n          JCSMPFactory.onlyInstance()\n              .createSendMultipleEntry(\n                  createMessage(record, useCorrelationKeyLatency, deliveryMode),\n                  destinationFn.apply(record));\n      entries[i] = entry;\n    }\n\n    return entries;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/MessageProducerUtils.java#L62-L98","documentation":"SolaceIO.Write throws this RuntimeException in MessageProducerUtils.createJCSMPSendMultipleEntry when a caller tries to build a transacted batch of more records than Solace supports in a single send-multiple (SOLACE_BATCH_LIMIT). Solace brokers reject oversized transacted send batches, so the connector fails fast before publishing a batch that would be rejected.","triggerScenarios":"Passing a `List<Solace.Record>` larger than the Solace batch limit (typically 50 messages) into `createJCSMPSendMultipleEntry(...)`, or configuring the Write transform so that buffered records per bundle/transaction exceed the limit.","commonSituations":"High-throughput writers with large batch-size configuration; grouping many elements in one bundle before flushing; using `withMaxBatchSize` (or equivalent) set above the broker's supported transacted batch limit.","solutions":["Reduce the writer's batch size configuration so each batch is <= SOLACE_BATCH_LIMIT.","Chunk the record list before calling createJCSMPSendMultipleEntry and send multiple smaller batches.","Check the SOLACE_BATCH_LIMIT constant in the connector version you use, since it caps batches at Solace's documented maximum.","If batches come from bundle size, lower the pipeline's bundle/flush sizing for the Write transform."],"exampleFix":"// before\nJCSMPSendMultipleEntry[] batch = MessageProducerUtils.createJCSMPSendMultipleEntry(allRecords, useLatency, destFn, DeliveryMode.PERSISTENT);\n// after\nfor (List<Solace.Record> chunk : Lists.partition(allRecords, SOLACE_BATCH_LIMIT)) {\n  JCSMPSendMultipleEntry[] batch = MessageProducerUtils.createJCSMPSendMultipleEntry(chunk, useLatency, destFn, DeliveryMode.PERSISTENT);\n  producer.sendMultiple(batch);\n}","handlingStrategy":"validation","validationCode":"if (records.size() > SOLACE_BATCH_LIMIT) {\n  throw new IllegalArgumentException(\"Batch of \" + records.size() + \" exceeds Solace limit \" + SOLACE_BATCH_LIMIT);\n}","typeGuard":null,"tryCatchPattern":"try { producer.sendMultiple(entries); } catch (RuntimeException e) { if (e.getMessage().contains(\"maximum of\")) { /* split batch and resend */ } throw e; }","preventionTips":["Keep writer batch-size config at or below Solace's transacted batch maximum","Use Lists.partition() to chunk large record lists before batching","Re-check SOLACE_BATCH_LIMIT when upgrading the connector or broker"],"tags":["solace","java","batch-size","write","limit-exceeded"],"backgroundTag":"value-out-of-range","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"}