public void send()

in export/src/main/java/com/google/cloud/healthcare/imaging/dicomadapter/CStoreSender.java [54:76]


  public void send(PubsubMessage message) throws Exception {
    String wadoUri = message.getData().toStringUtf8();
    String qidoUri = qidoFromWadoUri(wadoUri);

    // Invoke QIDO-RS to get DICOM tags needed to invoke C-Store.
    JSONArray qidoResponse = dicomWebClient.qidoRs(qidoUri);
    if (qidoResponse.length() != 1) {
      throw new IllegalArgumentException(
          "Invalid QidoRS JSON array length for response: " + qidoResponse.toString());
    }
    String sopClassUid = AttributesUtil.getTagValue(qidoResponse.getJSONObject(0),
        SOP_CLASS_UID_TAG);
    String sopInstanceUid = AttributesUtil.getTagValue(qidoResponse.getJSONObject(0),
        SOP_INSTANCE_UID_TAG);

    // Invoke WADO-RS to get bulk DICOM.
    InputStream responseStream = dicomWebClient.wadoRs(wadoUri);

    CountingInputStream countingStream = new CountingInputStream(responseStream);
    DicomClient.connectAndCstore(sopClassUid, sopInstanceUid, countingStream,
        applicationEntity, dimsePeerAET, dimsePeerIP, dimsePeerPort);
    MonitoringService.addEvent(Event.BYTES, countingStream.getCount());
  }