Skip to content

Bulk Create Listener

A registered listener will receive a real-time request for all bulkCreate API requests.

EventHandlerForClass *eventHandler = [Backendless.shared.data of:[Order class]].rt;
RTSubscription *subscription = [eventHandler addBulkCreateListenerWithResponseHandler:^(NSArray<NSString *> objectIds) {
    NSLog(@"%@ objects have been created");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let eventHandler = Backendless.shared.data.of(Order.self).rt
let subscription = eventHandler?.addBulkCreateListener(responseHandler: { objectIds in
    print("\(objectIds.count ?? 0) objects have been created")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

EventHandlerForMap *eventHandler = [Backendless.shared.data ofTable:@"Order"].rt;
RTSubscription *subscription = [eventHandler addBulkCreateListenerWithResponseHandler:^(NSArray *objectIds) {
    NSLog(@"%@ objects have been created", objectIds.count);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let eventHandler = Backendless.shared.data.ofTable("Order").rt
let subscription = eventHandler?.addBulkCreateListener(responseHandler: { objectIds in
    print("\(bulkEvent.count ?? 0) objects have been created")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

Return value

The callback delivers a collection of objectId values for the objects saved in the database.

Removing listeners

The method removes all registered listeners for the bulk update event:

// for the class-based approach:
EventHandlerForClass *eventHandler = [Backendless.shared.data of:[Order class]].rt;
[eventHandler removeBulkCreateListeners];

// for the map-based approach:
EventHandlerForMap *eventHandler = [Backendless.shared.data ofTable:@"Order"].rt;
[eventHandler removeBulkCreateListeners];
// for the class-based approach:
let eventHandler = Backendless.shared.data.of(Order.self).rt
eventHandler?.removeBulkCreateListeners()

// for the map-based approach:
let eventHandler = Backendless.shared.data.ofTable("Order").rt
eventHandler?.removeBulkCreateListeners()

Removing a specific listener

This method removes a listener identified by subscription that contains this listener:

// for the class-based approach:
// TODO

// for the map-based approach:
// TODO
// for the class-based approach:
// TODO

// for the map-based approach:
// TODO