Git Product home page Git Product logo

Comments (5)

codefromthecrypt avatar codefromthecrypt commented on July 17, 2024

thanks for raising this and pinging me. I'm muy interested this thread!

from azure-event-hubs-java.

JamesBirdsall avatar JamesBirdsall commented on July 17, 2024

An instance of EventProcessorHost creates an instance of IEventProcessor for every partition that it holds the lease for. A given instance of IEventProcessor is created when the EPH instance gets the lease for a partition and is permanently tied to that partition, being shut down and destroyed if and when the EPH instance loses the lease, or the EPH instance as a whole is shut down.

The loop at PartitionManager.java:423 iterates through all the leases and calls Pump.addPump() for each partition that this EPH instance owns. If there already is a pump for that partition, Pump checks its health and restarts if necessary (Pump.java:42); if there isn't one, it creates a new pump (Pump.java:54). Pump.createNewPump() creates a new instance of EventHubPartitionPump and starts it at Pump.java:60-61. The method startPump() is actually implemented on the parent class PartitionPump, and the processor factory is called to create a new IEventProcessor at PartitionPump.java:52.

from azure-event-hubs-java.

aliostad avatar aliostad commented on July 17, 2024

Thanks James.

This does not corroborate with my observations. As I said, constructor of my IEventProcessor gets called once while I have a single host working off 8 partitions. I guess the next step is to have a repro?

from azure-event-hubs-java.

JamesBirdsall avatar JamesBirdsall commented on July 17, 2024

A moment of clarification: what I describe is the behavior of the default IEventProcessorFactory. If you implement your own and call EventProcessorHost.RegisterEventProcessorFactory with it, then any pattern is possible. A user-implemented factory is free to only ever create one IEventProcessor instance and just dispense that instance whenever it is called to create an event processor. We have heard from customers who are doing exactly that.

I assuming that you are NOT doing a custom factory -- if you were, you'd know why your constructor was being called only once! For the default factory, the behavior is supposed to be as I describe, and if you can repro it failing, we would love to see that and fix it.

Thanks!

from azure-event-hubs-java.

aliostad avatar aliostad commented on July 17, 2024

Thanks James.

You are absolutely correct. I created a bare-bone example and I can see, as you said, we get an instance per partition.

from azure-event-hubs-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.