In October 2026 I interviewed with Iris Software for a Senior Java Engineer role. This is what I was asked, and how I would answer each question today. If you have an Iris interview coming up, the pattern is clear: Java design patterns and Kafka, with a coding question in between.
The questions I was asked
- Which Java design patterns have you used?
- What is the difference between an abstract class and the Abstract Factory pattern?
- Write code for an abstract method.
- Kafka: what is a key in Kafka?
- What is consumer lag?
- Can two consumers listen to the same partition?
- How does a consumer make sure it gets messages from the same partition?
1Which Java design patterns have you used?
Don't list ten patterns. Name two or three you really used and where. For example: Builder for request objects with many optional fields, Strategy to switch between payment providers, and Singleton (as Spring beans) for shared clients. Expect a follow-up on any pattern you name, so only name ones you can explain.
2Abstract class vs Abstract Factory
This sounds like one topic but it's two different levels:
| Abstract class | Abstract Factory | |
|---|---|---|
| What it is | A Java language feature | A creational design pattern |
| Purpose | Share code and force subclasses to implement some methods | Create families of related objects without naming their concrete classes |
| Example | abstract class Payment with abstract boolean pay() | UiFactory with button() and checkbox(), implemented by LightFactory and DarkFactory |
The link between them: an Abstract Factory is often written using an abstract class or an interface. Saying that sentence shows you understand both.
3Write code for an abstract method
abstract class Payment {
private final double amount;
protected Payment(double amount) { this.amount = amount; }
public double amount() { return amount; }
// No body: every kind of payment decides how to pay.
public abstract boolean pay();
// A normal method all payments share.
public void receipt() { System.out.println("Paid " + amount); }
}
class UpiPayment extends Payment {
private final String upiId;
UpiPayment(double amount, String upiId) {
super(amount);
this.upiId = upiId;
}
@Override
public boolean pay() {
// call the UPI gateway with upiId and amount()
return true;
}
}
Points to say while writing: an abstract class can't be instantiated, it can have a constructor and state, a
subclass must implement every abstract method or be abstract itself, and an abstract method can't be
private, static or final.
4What is a key in Kafka?
The key decides the partition a message goes to: Kafka hashes the key and picks a partition from it, so every message with the same key lands in the same partition, in order. Use the order ID or customer ID as the key when the order of events for that ID matters. With no key, messages are spread across partitions and there's no ordering between them. Keys also matter for compacted topics, which keep the latest value per key.
5What is consumer lag?
Lag is how far a consumer group is behind: the partition's latest offset minus the group's committed offset. A
growing lag means messages arrive faster than they're processed. Check it with
kafka-consumer-groups.sh --describe --group <name> or your monitoring. Fixes: speed up processing,
add consumers (up to the number of partitions), add partitions, or tune batch settings like
max.poll.records.
6Can two consumers listen to the same partition?
In the same consumer group: no. Each partition goes to one consumer in the group. Extra consumers sit idle. In different groups: yes. Each group reads every message independently, which is how several services consume the same topic. (Newer Kafka versions add share groups, where consumers share partitions like a queue, but the classic answer is the one above.)
7How does a consumer get messages from the same partition?
Two parts. Producers send related messages with the same key, so they always go to the same
partition. On the consumer side, the group assigns partitions. To keep that assignment stable use a sticky assignor
(CooperativeStickyAssignor) and static membership (group.instance.id) so restarts don't
reshuffle partitions. To read one exact partition, use consumer.assign() instead of
subscribe(). One catch worth mentioning: adding partitions changes which partition a key maps to.
What I'd tell you to prepare
- Two or three design patterns you have actually used, with the project.
- Kafka basics: keys, partitions, consumer groups, offsets and lag. These came as a chain of follow-ups.
- Small code on the spot: abstract classes, interfaces, a simple pattern.
More questions people were asked at Iris are on our Iris Software interview questions page, and the full Kafka list is in Kafka interview questions 2026.
Practise these before your interview
Our AI interviewer asks Java and Kafka questions out loud, gives you 30 seconds per answer and shows what you missed. Then challenge a friend to beat your score.