There are a lot of choices based on what you are looking to do.
How do you want to write the logic?
If you are looking to write code for your logic ( and not looking for a SQL like declarative language) then you can use one of Stream Processing Engines: Apache Storm, Apache Spark, Apache Fink, Apache Samza or Kafka Streams. The good news is all of them are open source.
Among them, my bet is Fink. It has a pretty nice architecture which handles many pitfalls others stepped into. Especially, if you want to do exactly once processing, Fink is the best bet.
However, writing java code to do this is fine if you do simple counting, but a nightmare if you want to do serious things like time windows, join and temporal event sequence patterns etc. ( see Patterns for Streaming Realtime Analytics for details on this argument). If you want to express the logic using a declarative language, then you will want to use Complex Event Processing, which let you write SQL-like queries and do complex things. Specifically, these kinds of queries support temporal operators like sliding windows, joins, temporal sequence patterns etc.
If you are looking for an Open source solution, the among the choices are WSO2 DAS (Data Analytics Server) formally known as WSO2 CEP ( Apache License) and Esper (GPL). ( Disclaimer I work for WSO2).
If you are OK to pay, then there is Tibco Stream Base, IBM Infosphere Streams, and SQLStreams. Both WSO2 DAS and Esper have commercial support if you need it. Paul Vincent is maintaining CEP market Survey which provides historical overview of almost all CEP engines.
Recent Forrester report surveyed the choices and you can find the details from 15 "True" Streaming Analytics Platforms For Real-Time Everything.
Above stream processing engines are adding support for SQL like query languages. However, they still lag behind with the features ( e.g. temporal sequence patterns). As I discussed in https://softwareengineeringdaily.com/2016/02/04/stream-processing-vs-complex-event-processing/, CEP and Stream processing engines are merging.
If you plan to process millions of events per second, then you need to setup a complex distributed processing graph. On this topic, stream processing has an advantage where they are historically built to scale. However, as I mentioned, these two models are merging.
If you are doing an IoT analytics, then the data creates a time series. In that case, often you need to do temporal operations such as sliding windows. On that use case, you are better off with an SQL like language hence I recommend to go for CEP.
Streaming + Batch
The final twist is whether you want to do batch ( MapReduce style processing) as well. If yes, read about Lambda Architecture and Kappa architecture. Apache Fink and WSO2 DAS supports this scenario. ( and there may be others).