code: public static void main(String[] args)
      throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
      try {
        /* play.min.io for test and development. */
        MinioClient minioClient = new MinioClient("https://play.min.io:9000", "Q3AM3UQ867SPQQA43P2F",
                                                  "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");
  
        /* Amazon S3: */
        // MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID",
        //                                           "YOUR-SECRETACCESSKEY");
  
        class TestBucketListener implements BucketEventListener {
          @Override
          public void updateEvent(NotificationInfo info) {
            System.out.println(info.records[0].s3.bucket.name + "/"
                + info.records[0].s3.object.key + " has been created");
          }
        }
  
        minioClient.listenBucketNotification("my-bucketname", "", "",
            new String[]{"s3:ObjectCreated:*"}, new TestBucketListener());
  
      } catch (MinioException e) {
        System.out.println("Error occurred: " + e);
      }
    }
docs: MinioClient.listenBucketNotification() example.