Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CAP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
CAP
Commits
1d408d09
Commit
1d408d09
authored
Sep 28, 2017
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
processing pages will contains Scheduled and Enqueued messages.
parent
72ab74b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
SqlServerMonitoringApi.cs
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
+14
-3
No files found.
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
View file @
1d408d09
...
@@ -32,7 +32,7 @@ select count(Id) from [{0}].Published with (nolock) where StatusName = N'Succeed
...
@@ -32,7 +32,7 @@ select count(Id) from [{0}].Published with (nolock) where StatusName = N'Succeed
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Succeeded';
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Succeeded';
select count(Id) from [{0}].Published with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Published with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Published with (nolock) where StatusName
= N'Processing'
;
select count(Id) from [{0}].Published with (nolock) where StatusName
in (N'Processing',N'Scheduled',N'Enqueued')
;
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Processing';"
,
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Processing';"
,
_options
.
Schema
);
_options
.
Schema
);
...
@@ -74,9 +74,16 @@ _options.Schema);
...
@@ -74,9 +74,16 @@ _options.Schema);
var
tableName
=
queryDto
.
MessageType
==
MessageType
.
Publish
?
"Published"
:
"Received"
;
var
tableName
=
queryDto
.
MessageType
==
MessageType
.
Publish
?
"Published"
:
"Received"
;
var
where
=
string
.
Empty
;
var
where
=
string
.
Empty
;
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
StatusName
))
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
StatusName
))
{
if
(
string
.
Equals
(
queryDto
.
StatusName
,
ProcessingState
.
StateName
,
StringComparison
.
CurrentCultureIgnoreCase
))
{
where
+=
" and statusname in (N'Processing',N'Scheduled',N'Enqueued')"
;
}
else
{
{
where
+=
" and statusname=@StatusName"
;
where
+=
" and statusname=@StatusName"
;
}
}
}
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
Name
))
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
Name
))
{
{
where
+=
" and name=@Name"
;
where
+=
" and name=@Name"
;
...
@@ -135,7 +142,10 @@ _options.Schema);
...
@@ -135,7 +142,10 @@ _options.Schema);
private
int
GetNumberOfMessage
(
IDbConnection
connection
,
string
tableName
,
string
statusName
)
private
int
GetNumberOfMessage
(
IDbConnection
connection
,
string
tableName
,
string
statusName
)
{
{
var
sqlQuery
=
$"select count(Id) from [
{
_options
.
Schema
}
].
{
tableName
}
with (nolock) where StatusName = @state"
;
var
sqlQuery
=
statusName
==
StatusName
.
Processing
?
$"select count(Id) from [
{
_options
.
Schema
}
].
{
tableName
}
with (nolock) where StatusName in (N'Processing',N'Scheduled',N'Enqueued')"
:
$"select count(Id) from [
{
_options
.
Schema
}
].
{
tableName
}
with (nolock) where StatusName = @state"
;
var
count
=
connection
.
ExecuteScalar
<
int
>(
sqlQuery
,
new
{
state
=
statusName
});
var
count
=
connection
.
ExecuteScalar
<
int
>(
sqlQuery
,
new
{
state
=
statusName
});
return
count
;
return
count
;
}
}
...
@@ -166,6 +176,7 @@ _options.Schema);
...
@@ -166,6 +176,7 @@ _options.Schema);
string
statusName
,
string
statusName
,
IDictionary
<
string
,
DateTime
>
keyMaps
)
IDictionary
<
string
,
DateTime
>
keyMaps
)
{
{
//SQL Server 2012+
string
sqlQuery
=
string
sqlQuery
=
$@"
$@"
with aggr as (
with aggr as (
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment