GithubHelp home page GithubHelp logo

espertechinc / nesper Goto Github PK

View Code? Open in Web Editor NEW
85.0 85.0 26.0 69.54 MB

NEsper - Complex Event Processing and Event Series Analysis for .NET

License: GNU General Public License v2.0

C# 99.82% PLpgSQL 0.06% ANTLR 0.11% Ruby 0.01% Batchfile 0.01% PowerShell 0.01% Shell 0.01% Dockerfile 0.01%

nesper's People

Contributors

ajaxx avatar bernhardttom avatar bernhardttom2 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nesper's Issues

Subqueries in FROM clause

Hi,

Does NESPER support subqueries within FROM clauses? I'm trying to follow the FROM documentation [1] (should be similar to SQL):
"The subquery_expr defines a subquery or nested EPL statement in parenthesis. A subquery is used to pre-filter event stream data seen by the outer EPL statement."

I'm getting a syntax error ("Incorrect syntax near '(' ") when I try to compose a simple query like this:
SELECT * FROM ( SELECT resultTime FROM Observation )

The "Simple and Correlated Subqueries" approach works but it is too limited - I can only access one event properties from a subquery, but I need to access multiple properties.

I want to relate three queries, such as:
SELECT *
FROM (SubQuery1) as X1, (SubQuery2) as X2, (SubQuery3) as X3,
WHERE X1.id = X2.id and X2.id = X3.id and X1.propA > 10

In addition, I'd like to be able to relate temporally these subqueries, e.g. an X1 followed by X2 within 10 seconds. Do I need to use the MATCHING clause or is it possible to do that with FROM? One of my goals is to be able to represent each Allen operator [2] in EPL statements.

Thanks.

Joao

[1] https://docs.oracle.com/cd/E13157_01/wlevs/docs30/epl_guide/clauses.html#wp1016544
[2] https://en.wikipedia.org/wiki/Allen%27s_interval_algebra

Syntax errors in esper-configuration-5-0.xsd

The specification for element driver in NEsper/etc/esper-configuration-5-0.xsd contains two syntax errors (unbound instead of unbounded and attribute inside sequence). Both can be fixed by:

$ diff -u esper-configuration-5-0.xsd esper-configuration-5-0-patched.xsd
--- esper-configuration-5-0.xsd 2018-03-13 15:03:04.505333100 +0100
+++ esper-configuration-5-0-patched.xsd 2018-06-05 13:34:39.197619200 +0200
@@ -235,9 +235,7 @@
        </xs:simpleType>
        <xs:element name="driver">
                <xs:complexType>
-                       <xs:sequence minOccurs="0" maxOccurs="unbound">
-                               <xs:attribute name="type" type="xs:string" use="required"/>
-                       </xs:sequence>
+                       <xs:attribute name="type" type="xs:string" use="required"/>
                        <xs:anyAttribute />
                </xs:complexType>
        </xs:element>

nesper version

is the nesper 5.2 version is feature equivalent to the esper 5.2?
we have a big .net enterprise product and we are considering both nesper and esper , as a .net company nesper will be easier for us to integrate but we noticed it does not have a big user base, is the support for the product is planed to be continued? are versions going to be continue to be correlated with esper?

NullReferenceException when using window() in having clause

The following throws a NullReferenceException if the number of rows in the named window MyValueWindow reaches 3:

select
    window(Value) as Data,
    window(Value).anyOf(x => x < 0) as HasNegative,
    count(*) as Count
from
    MyValueWindow
having
    count(*) = 3 and
    window(Value).anyOf(x => x < 0)

MyValueEvent is a simple class with one property Value of type double.

MyValueWindow is a named window:

create window MyValueWindow#length(3) as MyValueEvent

The select statement works without the second having condition window(Value).anyOf(x => x < 0).
With the condition, the statement throws the following error as soon as count(*) = 3 is true:

[ERROR] com.espertech.esper.core.service.ExceptionHandlingService - Exception encountered processing statement 'Select_MyValueWindow' expression 'select
  window(Value) as Data,
  window(Value).anyOf(x => x < 0) as HasNegative,
  count(*) as Count
from MyValueWindow
having
  count(*) = 3 and
  window(Value).anyOf(x => x < 0)' : Object reference not set to an instance of an object.
=======================================================(inner most exception)===
 (1) System.NullReferenceException
================================================================================
Method        :  SafeArrayCopy
Type          :  com.espertech.esper.events.EventBeanUtility
Assembly      :  NEsper, Version=6.0.1.0, Culture=neutral, PublicKeyToken=null
Assembly Path :  [...]\NEsper.dll
Source        :  NEsper
Thread        :  1 ''
Helplink      :

Message:
"Object reference not set to an instance of an object."

Stack Trace:
   at com.espertech.esper.events.EventBeanUtility.SafeArrayCopy(EventBean[] eventsPerStream, EventBean[] eventsLambda)
   at com.espertech.esper.epl.enummethod.dot.ExprDotEvalEnumMethodBase.Evaluate(Object target, EvaluateParams evalParams)
   at com.espertech.esper.epl.expression.dot.ExprDotNodeUtility.EvaluateChain(ExprDotEval[] evaluators, Object inner, EventBean[] eventsPerStream, Boolean isNewData, ExprEvaluato                                   rContext context)
   at com.espertech.esper.epl.expression.dot.ExprDotEvalRootChild.Evaluate(EvaluateParams evaluateParams)
   at com.espertech.esper.epl.expression.ops.ExprAndNodeImpl.Evaluate(EvaluateParams evaluateParams)
   at com.espertech.esper.epl.core.ResultSetProcessorRowForAll.GetSelectListEvents(Boolean isNewData, Boolean isSynthesize, Boolean join)
   at com.espertech.esper.epl.core.ResultSetProcessorRowForAll.ProcessViewResult(EventBean[] newData, EventBean[] oldData, Boolean isSynthesize)
   at com.espertech.esper.epl.view.OutputProcessViewDirect.Update(EventBean[] newData, EventBean[] oldData)
   at com.espertech.esper.view.ViewSupport.UpdateChildren(EventBean[] newData, EventBean[] oldData)
   at com.espertech.esper.epl.named.NamedWindowConsumerView.Update(EventBean[] newData, EventBean[] oldData)
   at com.espertech.esper.epl.named.NamedWindowDispatchServiceImpl.ProcessHandle(EPStatementAgentInstanceHandle handle, IList`1 value, EventBean[] newData, EventBean[] oldData)
================================================================================

NEsper version is 6.0.1.

Program.cs:

using System;
using System.Collections.Generic;
using System.Globalization;
using com.espertech.esper.client;

namespace WindowHaving
{
    public sealed class MyValueEvent
    {
        public double Value { get; }

        public MyValueEvent(double value)
        {
            Value = value;
        }

        public override string ToString()
        {
            return
                nameof(MyValueEvent) + "(" +
                nameof(Value) + "=" + Value.ToString(NumberFormatInfo.InvariantInfo) + ")";
        }
    }

    internal sealed class Program
    {
        private const bool TRIGGER_ERROR = true;

        #region Main wrapper

        private static void Main(string[] args)
        {
            try
            {
                var program = new Program();
                program.Setup();
                program.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }

        #endregion Main wrapper

        #region Initialize engine

        private EPServiceProvider _engine;

        private Program()
        {
            _engine = EPServiceProviderManager.GetDefaultProvider();
        }

        #endregion Initialize engine

        #region Setup with statement and running

        private void Setup()
        {
            EPAdministrator admin = _engine.EPAdministrator;
            admin.Configuration.AddEventType<MyValueEvent>();

            // Create window
            admin.CreateEPL(
                "create window MyValueWindow#length(3) as MyValueEvent",
                "CreateWindow_MyValueWindow")
            .Events += (sender, args) =>
            {
                Report("CreateWindow_MyValueWindow", args);
            };

            // Insert into window
            admin.CreateEPL(
                "insert into MyValueWindow\n" +
                "select *\n" +
                "from MyValueEvent\n" +
                "where Value in (-1 : 1)",
                "InsertInto_MyValueWindow");

            string epl =
                "select\n" +
                "  window(Value) as Data,\n" +
                "  window(Value).anyOf(x => x < 0) as HasNegative,\n" +
                "  count(*) as Count\n" +
                "from MyValueWindow\n" +
                "having\n" +
                "  count(*) = 3";
            if (TRIGGER_ERROR)
            {
                epl +=
                    " and\n" +
                "  window(Value).anyOf(x => x < 0)";
            }
            admin.CreateEPL(epl, "Select_MyValueWindow")
            .Events += (sender, args) =>
            {
                Report("Select_MyValueWindow", args);
            };
        }

        private void Run()
        {
            foreach (double value in new double[] { 3, .5, -.9, .4, -.3, 2 })
            {
                _engine.EPRuntime.SendEvent(new MyValueEvent(value));
            }
        }

        #endregion Setup with statement and running

        #region Helpers

        private void Report(string statementName, UpdateEventArgs args)
        {
            Console.WriteLine("* Statement: " + statementName);
            if (args.OldEvents != null)
            {
                for (int i = 0; i < args.OldEvents.Length; i++)
                {
                    var bean = args.OldEvents[i];
                    Console.WriteLine($"  Old[{i}]: {BeanToString(bean)}");
                }
            }

            if (args.NewEvents != null)
            {
                for (int i = 0; i < args.NewEvents.Length; i++)
                {
                    var bean = args.NewEvents[i];
                    Console.WriteLine($"  New[{i}]: {BeanToString(bean)}");
                }
            }
        }

        private string BeanToString(EventBean bean)
        {
            object underlying = bean.Underlying;
            if (underlying is MyValueEvent)
            {
                return underlying.ToString();
            }

            if (underlying is Dictionary<string, object>)
            {
                var dict = (Dictionary<string, object>)underlying;
                var items = new List<string>(dict.Count);
                foreach (var item in dict)
                {
                    string value;
                    if (item.Value is double[])
                    {
                        value = "[" + string.Join(", ", (double[])item.Value) + "]";
                    }
                    else
                    {
                        value = item.Value.ToString();
                    }

                    items.Add($"{item.Key}={value}");
                }

                return
                    "Dictionary(" + string.Join(", ", items) + ")";
            }

            return "UNKNOWN";
        }

        #endregion Helpers
    }
}

Measure data types

After adding event type using
void AddEventType(string eventTypeName, IDictionary<string, object> typeMap, string[] superTypes);
overload, I can send events, represented as Dictionary<string, object>, using overload
void SendEvent(IDictionary<string, object> map, string mapEventTypeName);
I can see, it is not forbbidden to add event type with integer/float-point values, but send events with strings as values in dictionary. Registred statements works correct, comparisons and arithmetical operations with integer and float-point numbers work correct, as if NEsper converts string values to corresponding type. But if I add bitwise operation into statement, this statements stops returning any results.
Also, when I subscrie to statement and look at NewEvents in the debugger, I see strings as original values and int or double as result of arithmetical operation.
Am I doing it wrong ?

[BUG REPORT] SQL metadata retrieval fails while processing output types for query

While creating HistoricalEventViewableDatabaseFactory object, OutputTypes property expects IDictionary<string, DBOutputTypeDesc>, however HistoricalEventViewableDatabaseForge generates a function that returns IDictionary<object, object>.

It causes an error while compiling the generated code for statements with external SQL db access:

error CS0266: Cannot implicitly convert type 'System.Collections.Generic.IDictionary<object, object>' to 'System.Collections.Generic.IDictionary<string, com.espertech.esper.common.@internal.epl.historical.database.core.DBOutputTypeDesc>'.

Replacing IDictionary template parameters in HistoricalEventViewableDatabaseForge.MakeOutputTypes fixes the issue.

System.String

Hi there, I'm busy creating an large scale CEP engine for my organization. We created a C# mapping, Dictionary<string,object> where the properties are like the following amount, System.Double ; registeredon, System.DateTime, firstname, System.String. Problem is that the process of AddEventType fails. the failure is here:

TypeHelper.cs
case "string":
return typeof(string);
line: 1361

You may need to add
case "system.string":

I did this in the code locally and the AddEventType process succeeded.

thank-you

Bug report, NEsper.Compiler

Hello NEsper,

In [email protected]'s CompareTo method, the following line causes a null exception when that.Namespace is null and none of the previous if conditions are stepped into.

else if (that.Namespace.StartsWith("System.")) {

I am not sure, but I think this code should be added at line 201 to fix the issue:

else if (that.Namespace == null) { nameComparison = 1; }

Kind regards

Setting internal timer as 'false'

I am trying to set the '.setInternalTimerEnabled(false)' property. I am unable to change the Configuration like shown in reference:

Configuration config = new Configuration();
config.getEngineDefaults().getThreading().setInternalTimerEnabled(false);

I found the following instructions, but I am unsure about how to implement it:

com.espertech.esper.util.EsperSectionHandler is provided to read Esper configuration from standard .NET configuration. It must be added as a configSection in order to be used.

Empty array is not possible

An empty array is possible according to the documentation for Esper 6.0.1:

9.5. Array Definition Operator
[...]
{ [expression [,expression...]] }

However, the definition in the grammar file NEsper/grammar/EsperEPL2Grammar.g4

elementValueArrayEnum : '{' (elementValueEnum (',' elementValueEnum)*)? (',')? '}';

requires a mandatory element.

Method invocation fails

Query
SELECT * FROM method:handler.getContext()

Configuration:
cepConfig.AddVariable<Handler>("handler", new Handler());

public class Handler
{
    public Dictionary<string, object> getContextMetadata()
    {
        return Metadata.get();
    }

    public IEnumerable<IDictionary<string, Object>> getContext()
    {
        foreach(var data in Data.get())
              yield return data;
    }
}

Error:
Unexpected exception starting statement: Could not find getter method for method invocation, expected a method by name 'getContextMetadata' accepting no parameters [SELECT * \nFROM method:handler.getContext()]

NullReferenceException when casting property to int (regression from 4.8 and 5.0.1)

The following EPL does not work on NEsper above v4.8 (NB it also works with 5.0.1, the only other 5.x version I tested with):

select cast(cast(Properties('value'), string), int) as Value
from PropertiesEvent

The PropertiesEvent is defined as:

public class PropertiesEvent
{
    public IDictionary<string, object> Properties { get; set; }
}

Check the test at EplTest.cs:CastPropertyToIntRegression. If you checkout the nesper-4.8 branch (same code, only the nesper libraries are changed) it works fine.

Can you reproduce the problem?

I'm using normal .NET 4.6 on Windows.

Add persistence to NEsper engine.

Add the ability to dehydrate and hydrate state from a NEsper instance.
Consider implications of incremental dehydration.
Consider implications of real-time dehyrdration.

8.0-wip rebase to master

I'm creating this issue in preparation for the major rebase of the 8.0-wip branch to master. As part of this rebase, I've already identified that a git rebase is not an option. There are breaks in the git commit log that prevent a straight rebase (e.g. squash) from the commits.

Please add any issues you believe need to be tracked as part of the 8.0-wip rebase to master. And finally... it appears we're about to finalize this version, thank you for your patience.

Syntax error around enumeration method

The following statement collects a sequence of positive values or a sequence of negative values using the repeat until pattern:

select
    (coalesce(a, b)).countOf() as Count
from pattern[
    every ([3:] a=MyValueEvent(Value > 0) until MyValueEvent(Value <= 0))
    or
    every ([3:] b=MyValueEvent(Value < 0) until MyValueEvent(Value >= 0))
]

The form without parentheses coalesce(a, b).countOf() is rejected with an Incorrect syntax error.

However, if the statement is constructed via the EPStatementObjectModel, then the EPL string export does not add the parentheses. The Program.cs shows the successful parsing of the EPL statement version from above. Then the statement is compiled to the model representation. Creating a statement using the EPL string from the model representation is no longer possible because of the syntax exception.

The output of the program:


Original EPL statement
----------------------
select
    (coalesce(a, b)).countOf() as Count
from pattern[
    every ([3:] a=MyValueEvent(Value > 0) until MyValueEvent(Value <= 0))
    or
    every ([3:] b=MyValueEvent(Value < 0) until MyValueEvent(Value >= 0))
]

EPL from EPStatementObjectModel
-------------------------------
select coalesce(a,b).countOf() as Count from pattern [every ([3:] a=MyValueEvent(Value>0) until MyValueEvent(Value<=0)) or every ([3:] b=MyValueEvent(Value<0) until MyValueEvent(Value>=0))]

EPL without parentheses causes exception
----------------------------------------
com.espertech.esper.client.EPStatementSyntaxException: Incorrect syntax near '.' at line 1 column 20 [select coalesce(a,b).countOf() as Count from pattern [every ([3:] a=MyValueEvent(Value>0) until MyValueEvent(Value<=0)) or every ([3:] b=MyValueEvent(Value<0) until MyValueEvent(Value>=0))]]
   at com.espertech.esper.epl.parse.ParseHelper.Parse(String expression, String eplStatementErrorMsg, Boolean addPleaseCheck, ParseRuleSelector parseRuleSelector, Boolean rewriteScript)
   at com.espertech.esper.core.service.EPAdministratorHelper.CompileEPL(String eplStatement, String eplStatementForErrorMsg, Boolean addPleaseCheck, String statementName, SelectClauseStreamSelectorEnum defaultStreamSelector, EngineImportService engineImportService, VariableService variableService, SchedulingService schedulingService, String engineURI, ConfigurationInformation configSnapshot, PatternNodeFactory patternNodeFactory, ContextManagementService contextManagementService, ExprDeclaredService exprDeclaredService, TableService tableService)
   at com.espertech.esper.core.service.EPAdministratorHelper.CompileEPL(String eplStatement, String eplStatementForErrorMsg, Boolean addPleaseCheck, String statementName, EPServicesContext services, SelectClauseStreamSelectorEnum defaultStreamSelector)
   at com.espertech.esper.core.service.EPAdministratorImpl.CreateEPLStmt(String eplStatement, String statementName, Object userobject, Nullable`1 optionalStatementId)
   at com.espertech.esper.core.service.EPAdministratorImpl.CreateEPL(String eplStatement)
   at WindowHaving.Program.Main(String[] args) in [...]Program.cs:line 60

The Program.cs file:


using System;
using System.Globalization;
using com.espertech.esper.client;
using com.espertech.esper.client.soda;

namespace WindowHaving
{
    public sealed class MyValueEvent
    {
        public double Value { get; }

        public MyValueEvent(double value)
        {
            Value = value;
        }

        public override string ToString()
        {
            return
                nameof(MyValueEvent) + "(" +
                nameof(Value) + "=" + Value.ToString(NumberFormatInfo.InvariantInfo) + ")";
        }
    }

    internal sealed class Program
    {
        private static void Main(string[] args)
        {
            try
            {
                EPServiceProvider engine = EPServiceProviderManager.GetDefaultProvider();
                EPAdministrator admin = engine.EPAdministrator;
                admin.Configuration.AddEventType<MyValueEvent>();

                const string originalEplStatement =
                    "select\n" +
                    "    (coalesce(a, b)).countOf() as Count\n" +
                    "from pattern[\n" +
                    "    every ([3:] a=MyValueEvent(Value > 0) until MyValueEvent(Value <= 0))\n" +
                    "    or\n" +
                    "    every ([3:] b=MyValueEvent(Value < 0) until MyValueEvent(Value >= 0))\n" +
                    "]";
                EPStatement statement = admin.CreateEPL(originalEplStatement);
                EPStatementObjectModel model = admin.CompileEPL(originalEplStatement);
                string eplStatementFromObjectModel = model.ToEPL();

                Console.WriteLine("Original EPL statement");
                Console.WriteLine("----------------------");
                Console.WriteLine(originalEplStatement);
                Console.WriteLine("");

                Console.WriteLine("EPL from EPStatementObjectModel");
                Console.WriteLine("-------------------------------");
                Console.WriteLine(eplStatementFromObjectModel);
                Console.WriteLine("");

                Console.WriteLine("EPL without parentheses causes exception");
                Console.WriteLine("----------------------------------------");
                admin.CreateEPL(eplStatementFromObjectModel);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
    }
}

IMHO, the additional parentheses in (coalesce(a, b)).countOf() should not be necessary. Function parameters should have a higher precedence than the dot operator and coalesce(a, b).countOf() should suffice.

8.5.1 stockticker example outdated

com.espertech.esper.common.client.EPRuntimeException:“com.espertech.esper.common.client.EPRuntimeException: Error during compilation: Incorrect syntax near 'every' (a reserved keyword) [every Pricelimit=PriceLimit()] [every Pricelimit=PriceLimit()]”

I do not know why, who can help me thanks!

Non safe Assembly.GetTypes() call in DiscoverEngines method

In ScriptingServiceImpl.cs.
Function DiscoverEngines, iterates on all Current AppDomain Loaded assemblies.
For each assembly, a GetTypes() function is called.

In my application, this is unsafe because, you try to load types from assemblies that Nesper has no interface with. For example, my application crashes because missing DevExpress dlls, when trying to init a nesper instance.

You should either make the function safe (attached) or only supply an interface for searching engines on specific assemblies.

ScriptingServiceImpl.txt

unknown lock type 'MonitorLock'"

Hi,

I am using nuget package of nesper. As you can see following error output, it couldn't find monitor lock type and couldn't start default service provider

        static EPRuntime _runtime;
        static List<string> eplStatements;
        static MessageHandler mh;
        static Configuration nesperConf;
        static EPServiceProvider epService;

        private static void InitializeNesper()
        {
            nesperConf = new Configuration();
            nesperConf.AddEventType(typeof(Payload));
            if (nesperConf.EngineDefaults.ThreadingConfig.IsInternalTimerEnabled)
            {
                Console.WriteLine("enabled");
            };
            epService = EPServiceProviderManager.GetDefaultProvider(nesperConf);
            _runtime = epService.EPRuntime;
            mh = new MessageHandler();
            mh.UpdatePrediction += Predict;
        }

The type initializer for 'com.espertech.esper.compat.threading.LockManager' threw an exception.

System.TypeInitializationException was unhandled HResult=-2146233036 Message=The type initializer for 'com.espertech.esper.client.EPServiceProviderManager' threw an exception. Source=NEsper TypeName=com.espertech.esper.client.EPServiceProviderManager StackTrace: at com.espertech.esper.client.EPServiceProviderManager.GetDefaultProvider(Configuration configuration) at MT4EventMontior.Program.InitializeNesper() in c:\EventMontior\Program.cs:line 46 at MT4EventMontior.Program.Main(String[] args) in c:\EventMontior\Program.cs:line 89 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: HResult=-2146233036 Message=The type initializer for 'com.espertech.esper.compat.threading.LockManager' threw an exception. Source=NEsper TypeName=com.espertech.esper.compat.threading.LockManager StackTrace: at com.espertech.esper.compat.threading.LockManager.CreateLock(Type typeCategory) at com.espertech.esper.client.EPServiceProviderManager..cctor() InnerException: HResult=-2147024809 **Message=unknown lock type 'MonitorLock'** Source=NEsper StackTrace: at com.espertech.esper.compat.threading.LockManager..cctor() InnerException:

Incorrect call to PerformanceObserverWin on Linux platforms running under .net core

Related to #22, where an example source code can be taken. Run it on Linux (given you have applied a workaround for .net core serialisation of timezones #23).

It looks like PerformanceObserverWin class is resolved incorrectly to trace performance counters on Linux platform, the class tries to load a Windows dll that doesn't exist on Linux. The following exception is thrown while NEsper engine is being initialised.

Unhandled Exception: System.TypeInitializationException: The type initializer for 'com.espertech.esper.compat.threading.SlimLock' threw an exception. ---> System.TypeInitializationException: The type initializer for 'com.espertech.esper.compat.PerformanceObserverWin' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'Kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libKernel32.dll: cannot open shared object file: No such file or directory
   at com.espertech.esper.compat.PerformanceObserverWin.QueryPerformanceFrequency(Int64& lpFrequency)
   at com.espertech.esper.compat.PerformanceObserverWin.Calibrate()
   at com.espertech.esper.compat.PerformanceObserverWin..cctor()
   --- End of inner exception stack trace ---
   at com.espertech.esper.compat.threading.SlimLock..cctor()
   --- End of inner exception stack trace ---
   at com.espertech.esper.compat.threading.SlimLock..ctor()
   at com.espertech.esper.compat.threading.MonitorSlimLock..ctor(Int32 lockTimeout)
   at com.espertech.esper.compat.collections.CopyOnWriteList`1..ctor()
   at com.espertech.esper.compat.collections.CopyOnWriteArraySet`1..ctor()
   at com.espertech.esper.filter.FilterServiceBase..ctor(ILockManager lockManager, FilterServiceGranularLockFactory lockFactory, Boolean allowIsolation)
   at com.espertech.esper.filter.FilterServiceLockCoarse..ctor(ILockManager lockManager, IReaderWriterLockManager rwLockManager, Boolean allowIsolation)
   at com.espertech.esper.filter.FilterServiceProvider.NewService(ILockManager lockManager, IReaderWriterLockManager rwLockManager, FilterServiceProfile filterServiceProfile, Boolean allowIsolation)
   at com.espertech.esper.core.service.EPServicesContextFactoryDefault.CreateServicesContext(IContainer container, EPServiceProvider epServiceProvider, ConfigurationInformation configSnapshot)
   at com.espertech.esper.core.service.EPServiceProviderImpl.DoInitialize(Nullable`1 startTime)
   at com.espertech.esper.core.service.EPServiceProviderImpl..ctor(IContainer container, Configuration configuration, String engineURI, IDictionary`2 runtimes)
   at com.espertech.esper.client.EPServiceProviderManager.GetProviderInternal(IContainer container, Configuration configuration, String providerURINonNull)
   at com.espertech.esper.client.EPServiceProviderManager.GetProvider(IContainer container, String providerURI, Configuration configuration)
   at com.espertech.esper.client.EPServiceProviderManager.GetDefaultProvider(IContainer container)
   at com.espertech.esper.client.EPServiceProviderManager.GetDefaultProvider()
   %user_callstack_starts_here%

NEsper 5.3 nuget package references the wrong Common.Logging package

Did you guys tested the latest nuget package? The nuget package references the Common.Logging package version 2.2 but the binary requires 3.3 (updating Common.Logging to 3.3.1 seems to work with NEsper):

=== Pre-bind state information ===
LOG: DisplayName = Common.Logging, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e
 (Fully-specified)
LOG: Appbase = file:///C:/Users/rgl/MEOCloud/Projects/UseNEsper2/UseNEsper2/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NEsper, Version=5.3.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\rgl\MEOCloud\Projects\UseNEsper2\UseNEsper2\bin\Debug\UseNEsper2.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Common.Logging, Version=3.3.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e
LOG: Attempting download of new URL file:///C:/Users/rgl/MEOCloud/Projects/UseNEsper2/UseNEsper2/bin/Debug/Common.Logging.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Can not destroy/dispose a statement

hi,
I am getting this MissingMethodException during disposing a statement

System.MissingMethodException: Method not found: 'Void Castle.Core.Internal.CollectionExtensions.ForEach(System.Collections.Generic.IEnumerable1<!!0>, System.Action1<!!0>)'. at com.espertech.esper.core.start.EPStatementDestroyCallbackList.Destroy() at com.espertech.esper.core.service.StatementLifecycleSvcImpl.DestroyInternal(EPStatementDesc desc) at com.espertech.esper.core.service.StatementLifecycleSvcImpl.Dispose(Int32 statementId) at com.espertech.esper.core.service.EPStatementImpl.Dispose() in Program.cs:line 171

I also tried to remove listeners and stop statement first, but I got the same error again.

epService.EPAdministrator.GetStatement("test").RemoveAllEventHandlers();
epService.EPAdministrator.GetStatement("test").Stop();
epService.EPAdministrator.GetStatement("test").Dispose();

Is this about Castle.Core version ?

Here is packages.config of project
https://gist.github.com/agtokty/4bef3fed5251ceb98128fa524ada7f7a

Error when EPServiceProviderManager.GetDefaultProvider();

I'm migrating esper java to nesper net core, in java works perfect. But now in net core, i'm having some troubles. In the line EPServiceProvider serviceProvider = EPServiceProviderManager.GetDefaultProvider(); i'm getting this error
i don't know why is throwing me this error, because i don't pass any parameter Month o something like that.
My code

    public class Events
    {
    public static Events Instance;
    private string Expression;
    private EPRuntime Runtime { get; set; }
    private EPAdministrator Administrator { get; set; }
    private EPStatement Statement { get; set; }
    private RulesHandler Handler { get; set; } = RulesHandler.GetInstance;

    private IDataAccessSprayerTruck _sprayerTruckDataAccess;
    private IDataAccessUser _userDataAccess;

    protected Events()
    {
        IServiceCollection services = new ServiceCollection();

        services.AddScoped<IDataAccessSprayerTruck, SprayerTruckDataAccess>();
        services.AddScoped<IDataAccessUser, UserDataAccess>();

        IServiceProvider provider = services.BuildServiceProvider();

        _sprayerTruckDataAccess = provider.GetService<IDataAccessSprayerTruck>();
        _userDataAccess = provider.GetService<IDataAccessUser>();

        InitializeEsper();
    }

    public static Events GetInstance
    {
        get
        {
            if (Instance == null)
                Instance = new Events();

            return Instance;
        }
    }

    private void InitializeEsper()
    {
        try
        { 
            EPServiceProvider serviceProvider = EPServiceProviderManager.GetDefaultProvider(EventConfig());
            Runtime = serviceProvider.EPRuntime;
            Administrator = serviceProvider.EPAdministrator;
            Administrator.Configuration.AddEventType<Record>();
        }
        catch (Exception ex)
        {
            Console.WriteLine("ERROR --> InitializeEsper: " + ex.Message);
        }
    }

    private static Configuration EventConfig()
    {
        Configuration config = new Configuration();
        config.AddEventType<Record>();
        return config;
    }

    public void GenerateEvent(Record record)
    {
        if (record != null)
        {
            if (Expression != null)
            {
                Runtime.SendEvent(record);
            }
        }
    }

    }

I call the method GenerateEvent

    private Events Events { get; set; } = Events.GetInstance;
    Events.GenerateEvent(record);

8.5.4 epl "time" is Doesn't work

hello,
eplone=select *,max(price) from ObjectEvent#time(2 sec)
epltwo=select *,max(price) from ObjectEvent

The result is the same, "time" is Doesn't work

When grouping on an event itself the `group by` clause doesn' work

The following EPL does not work on NEsper above v4.8:

select Service, count(*) as Value
from Service.win:time_batch(1 seconds)
group by Service
order by Service

Check the test at EplTest.cs:GroupByRegression. If you checkout the nesper-4.8 branch (same code, only the nesper libraries are changed) it works fine.

If you comment the group by Service the statement generates output, so it seems group by is broken.

Can you reproduce the problem?

I'm using normal .NET 4.6 on Windows.

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.