glcrazier commented on code in PR #767: URL: https://github.com/apache/rocketmq-clients/pull/767#discussion_r1673495957
########## rust/src/push_consumer.rs: ########## @@ -0,0 +1,1303 @@ +/* + * 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. + */ + +use mockall::automock; +use mockall_double::double; +use parking_lot::{Mutex, RwLock}; +use prost_types::Duration; +use slog::Logger; +use slog::{debug, error, info, warn}; +use std::collections::{HashMap, VecDeque}; +use std::sync::Arc; +use tokio::select; +use tokio::sync::{mpsc, oneshot}; + +#[double] +use crate::client::Client; +use crate::conf::{BackOffRetryPolicy, ClientOption, PushConsumerOption}; +use crate::error::{ClientError, ErrorKind}; +use crate::model::common::{ClientType, ConsumeResult, FilterExpression, MessageQueue}; +use crate::model::message::{AckMessageEntry, MessageView}; +use crate::pb::receive_message_response::Content; +use crate::pb::{ + AckMessageRequest, Assignment, ChangeInvisibleDurationRequest, QueryAssignmentRequest, + ReceiveMessageRequest, Resource, +}; +use crate::session::{RPCClient, Session}; +use crate::util::{build_endpoints_by_message_queue, build_push_consumer_settings}; +use crate::{log, pb}; + +const OPERATION_NEW_PUSH_CONSUMER: &str = "push_consumer.new"; +const OPERATION_RECEIVE_MESSAGE: &str = "push_consumer.receive_message"; +const OPERATION_ACK_MESSAGE: &str = "push_consumer.ack_message"; +const OPERATION_START_PUSH_CONSUMER: &str = "push_consumer.start"; +const OPERATION_CHANGE_INVISIBLE_DURATION: &str = "push_consumer.change_invisible_duration"; + +pub type MessageListener = Box<dyn Fn(&MessageView) -> ConsumeResult + Send + Sync>; Review Comment: The FnMut requires exclusive access in threads which means incapable of concurrent consumption. Do you have any idea? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org