code: int add_filter_for_channel(EventChannelStruct event_channel_struct, String constraint_expr) throws DevFailed {
          Filter filter = null;
          int filter_id = -1;
          try {
              FilterFactory ffp = event_channel_struct.eventChannel.default_filter_factory();
              filter = ffp.create_filter("EXTENDED_TCL");
          } catch (org.omg.CosNotifyFilter.InvalidGrammar ex) {
              Except.throw_event_system_failed("API_NotificationServiceFailed",
                      "Caught Invalid Grammar exception while creating heartbeat filter : check filter",
                      "EventConsumer.add_filter_for_channel");
          }
  
          ConstraintExp[] exp = new ConstraintExp[1];
          exp[0] = new ConstraintExp();
          exp[0].event_types = new EventType[0];
          exp[0].constraint_expr = constraint_expr;
          try {
              if (filter != null) {
                  filter.add_constraints(exp);
                  filter_id = event_channel_struct.structuredProxyPushSupplier.add_filter(filter);
              }
          } catch (org.omg.CosNotifyFilter.InvalidConstraint ex) {
              filter.destroy();
              Except.throw_event_system_failed("API_NotificationServiceFailed",
                      "Caught InvalidConstraint exception while adding constraint for heartbeat : check filter",
                      "EventConsumer.add_filter_for_channel");
          }
          return filter_id;
      }
docs: ===============================================================