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
591f2c73
Commit
591f2c73
authored
Sep 08, 2017
by
yangxiaodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dashboard of sql server storage impl
parent
e9aaf305
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
0 deletions
+50
-0
MySqlStorageConnection.cs
src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs
+12
-0
PostgreSqlStorageConnection.cs
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
+11
-0
SqlServerMonitoringApi.cs
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
+5
-0
SqlServerStorageConnection.cs
src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs
+22
-0
No files found.
src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs
View file @
591f2c73
...
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
...
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using
Dapper
;
using
Dapper
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Processor.States
;
using
MySql.Data.MySqlClient
;
using
MySql.Data.MySqlClient
;
namespace
DotNetCore.CAP.MySql
namespace
DotNetCore.CAP.MySql
...
@@ -117,6 +118,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -117,6 +118,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
}
}
}
}
public
void
Dispose
()
public
void
Dispose
()
{
{
}
}
...
@@ -168,5 +170,15 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -168,5 +170,15 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
bool
ChangePublishedState
(
int
messageId
,
IState
state
)
{
throw
new
NotImplementedException
();
}
public
bool
ChangeReceivedState
(
int
messageId
,
IState
state
)
{
throw
new
NotImplementedException
();
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
View file @
591f2c73
...
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
...
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using
Dapper
;
using
Dapper
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Processor.States
;
using
Npgsql
;
using
Npgsql
;
namespace
DotNetCore.CAP.PostgreSql
namespace
DotNetCore.CAP.PostgreSql
...
@@ -153,5 +154,15 @@ namespace DotNetCore.CAP.PostgreSql
...
@@ -153,5 +154,15 @@ namespace DotNetCore.CAP.PostgreSql
{
{
throw
new
NotImplementedException
();
throw
new
NotImplementedException
();
}
}
public
bool
ChangePublishedState
(
int
messageId
,
IState
state
)
{
throw
new
NotImplementedException
();
}
public
bool
ChangeReceivedState
(
int
messageId
,
IState
state
)
{
throw
new
NotImplementedException
();
}
}
}
}
}
\ No newline at end of file
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
View file @
591f2c73
...
@@ -94,6 +94,10 @@ _options.Schema);
...
@@ -94,6 +94,10 @@ _options.Schema);
{
{
where
+=
" and name=@Name"
;
where
+=
" and name=@Name"
;
}
}
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
Name
))
{
where
+=
" and group=@Group"
;
}
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
Content
))
if
(!
string
.
IsNullOrEmpty
(
queryDto
.
Content
))
{
{
where
+=
" and content like '%@Content%'"
;
where
+=
" and content like '%@Content%'"
;
...
@@ -106,6 +110,7 @@ _options.Schema);
...
@@ -106,6 +110,7 @@ _options.Schema);
return
conn
.
Query
<
MessageDto
>(
sqlQuery
,
new
return
conn
.
Query
<
MessageDto
>(
sqlQuery
,
new
{
{
StatusName
=
queryDto
.
StatusName
,
StatusName
=
queryDto
.
StatusName
,
Group
=
queryDto
.
Group
,
Name
=
queryDto
.
Name
,
Name
=
queryDto
.
Name
,
Content
=
queryDto
.
Content
,
Content
=
queryDto
.
Content
,
Offset
=
queryDto
.
CurrentPage
*
queryDto
.
PageSize
,
Offset
=
queryDto
.
CurrentPage
*
queryDto
.
PageSize
,
...
...
src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs
View file @
591f2c73
...
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
...
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using
Dapper
;
using
Dapper
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Infrastructure
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Models
;
using
DotNetCore.CAP.Processor.States
;
namespace
DotNetCore.CAP.SqlServer
namespace
DotNetCore.CAP.SqlServer
{
{
...
@@ -65,6 +66,16 @@ OUTPUT DELETED.MessageId,DELETED.[MessageType];";
...
@@ -65,6 +66,16 @@ OUTPUT DELETED.MessageId,DELETED.[MessageType];";
}
}
}
}
public
bool
ChangePublishedState
(
int
messageId
,
IState
state
)
{
var
sql
=
$"UPDATE [
{
_options
.
Schema
}
].[Published] SET Retries=Retries+1,StatusName = '
{
state
.
Name
}
' WHERE Id=
{
messageId
}
"
;
using
(
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
))
{
return
connection
.
Execute
(
sql
)
>
0
;
}
}
// CapReceviedMessage
// CapReceviedMessage
public
async
Task
StoreReceivedMessageAsync
(
CapReceivedMessage
message
)
public
async
Task
StoreReceivedMessageAsync
(
CapReceivedMessage
message
)
...
@@ -108,6 +119,16 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -108,6 +119,16 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
}
}
}
}
public
bool
ChangeReceivedState
(
int
messageId
,
IState
state
)
{
var
sql
=
$"UPDATE [
{
_options
.
Schema
}
].[Received] SET Retries=Retries+1,StatusName = '
{
state
.
Name
}
' WHERE Id=
{
messageId
}
"
;
using
(
var
connection
=
new
SqlConnection
(
_options
.
ConnectionString
))
{
return
connection
.
Execute
(
sql
)
>
0
;
}
}
public
void
Dispose
()
public
void
Dispose
()
{
{
}
}
...
@@ -161,5 +182,6 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
...
@@ -161,5 +182,6 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);";
{
{
return
new
StateData
();
return
new
StateData
();
}
}
}
}
}
}
\ No newline at end of file
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