Open gdp507 opened 6 years ago
I'm also encountering the same issue. Is there a fix for this issue?
If you want export options from configuration file it must have ConsumerGroupOptions type. E.x.: config.ts
interface IKafkaConsumerGroup {
options: ConsumerGroupOptions;
}
export const config: IKafkaConsumerGroup = {
options: {
id: 'watch-001',
kafkaHost: 'localhost:9092',
groupId: 'TestGroup',
protocol: ['roundrobin'],
fromOffset: 'earliest',
autoCommit: true
},
}
app.ts
import { config } from './config';
...
const consumer = new ConsumerGroup(config.options, ['test']);
...
Hi All, I'm trying to use consumerGroup instead of HighLevelConsumer in a typescript project, but I'm not able to configure consumerOptions for consumerGroup.
Bug Report
I am getting the following error when I assign
1 ) fromOffset: 'earliest',
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; fromOffset: string; groupId...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'fromOffset' are incompatible. Type 'string' is not assignable to type '"earliest" | "latest" | "none"'.
2)protocol: ['roundrobin']
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; protocol: string[]; groupId...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'protocol' are incompatible. Type 'string[]' is not assignable to type '("roundrobin" | "range" | CustomPartitionAssignmentProtocol)[]'. Type 'string' is not assignable to type '"roundrobin" | "range" | CustomPartitionAssignmentProtocol'.
3) outOfRangeOffset: 'earliest'
Argument of type '{ autoCommit: boolean; fetchMaxBytes: number; fetchMaxWaitMs: number; outOfRangeOffset: string; g...' is not assignable to parameter of type 'ConsumerGroupOptions'. Types of property 'outOfRangeOffset' are incompatible. Type 'string' is not assignable to type '"earliest" | "latest" | "none"'.
Environment
Can anyone help me understand where I am going wrong? Thanks in advance.