rocketmq-client-nodejs
Version:
RocketMQ Node.js Client
39 lines • 2.31 kB
JavaScript
;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsumeTask = void 0;
const ConsumeResult_1 = require("./ConsumeResult");
class ConsumeTask {
#messageListener;
#messageView;
constructor(_clientId, messageListener, messageView) {
this.#messageListener = messageListener;
this.#messageView = messageView;
}
async call() {
try {
return await this.#messageListener.consume(this.#messageView);
}
catch (e) {
// Message listener raised an exception while consuming messages
return ConsumeResult_1.ConsumeResult.FAILURE;
}
}
}
exports.ConsumeTask = ConsumeTask;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc3VtZVRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3VtZXIvQ29uc3VtZVRhc2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBR0gsbURBQWdEO0FBR2hELE1BQWEsV0FBVztJQUNiLGdCQUFnQixDQUFrQjtJQUNsQyxZQUFZLENBQWM7SUFFbkMsWUFBWSxTQUFpQixFQUFFLGVBQWdDLEVBQUUsV0FBd0I7UUFDdkYsSUFBSSxDQUFDLGdCQUFnQixHQUFHLGVBQWUsQ0FBQztRQUN4QyxJQUFJLENBQUMsWUFBWSxHQUFHLFdBQVcsQ0FBQztJQUNsQyxDQUFDO0lBRUQsS0FBSyxDQUFDLElBQUk7UUFDUixJQUFJLENBQUM7WUFDSCxPQUFPLE1BQU0sSUFBSSxDQUFDLGdCQUFnQixDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDaEUsQ0FBQztRQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUM7WUFDWCxnRUFBZ0U7WUFDaEUsT0FBTyw2QkFBYSxDQUFDLE9BQU8sQ0FBQztRQUMvQixDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBakJELGtDQWlCQyJ9