安排多通知Android

时间:2018-12-17 20:36:36

标签: android

我正在尝试安排3条每日通知。我使用下面的代码,但是每次它为每个警报生成7条通知时都会出现问题。我不确定问题出在哪里。您能帮我解决这个问题吗?

pipeline.apply("Read from Avro", AvroIO.readGenericRecords(schema).from("test.test"))
                .apply(ParDo.of(new TransformAvro()))
                .apply("Write to Bigtable", write);
        return pipeline.run();


Below is the TransformAvro DoFn function

  try {
                String fieldName = field.schema().getName();
                fieldNameByte = fieldName.getBytes("UTF-8");

                String value = String.valueOf(gen.get(fieldName));
                fieldValueByte = value.getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            Mutation.SetCell setCell =
                    Mutation.SetCell.newBuilder()
                            .setFamilyName(COLUMN_FAMILY_NAME)
                            .setColumnQualifier(ByteString.copyFrom(fieldNameByte))
                            .setTimestampMicros(-1)
                            .setValue(ByteString.copyFrom(fieldValueByte))
                            .build();

        mutations.add(Mutation.newBuilder().setSetCell(setCell).build());

        }

         c.output(KV.of(ByteString.copyFrom("test".getBytes()), mutations.build()));

0 个答案:

没有答案