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
02c0eefd
Commit
02c0eefd
authored
Nov 19, 2019
by
Savorboard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change System.Text.Json to Json.NET
parent
b3aeb1a2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
12 deletions
+24
-12
IConnectionPool.Default.cs
src/DotNetCore.CAP.Kafka/IConnectionPool.Default.cs
+2
-2
DotNetCore.CAP.csproj
src/DotNetCore.CAP/DotNetCore.CAP.csproj
+1
-1
ISerializer.JsonUtf8.cs
src/DotNetCore.CAP/Serialization/ISerializer.JsonUtf8.cs
+10
-4
ISerializer.cs
src/DotNetCore.CAP/Serialization/ISerializer.cs
+4
-1
StringSerializer.cs
src/DotNetCore.CAP/Serialization/StringSerializer.cs
+7
-4
No files found.
src/DotNetCore.CAP.Kafka/IConnectionPool.Default.cs
View file @
02c0eefd
...
...
@@ -3,11 +3,11 @@
using
System
;
using
System.Collections.Concurrent
;
using
System.Text.Json
;
using
System.Threading
;
using
Confluent.Kafka
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Newtonsoft.Json
;
namespace
DotNetCore.CAP.Kafka
{
...
...
@@ -24,7 +24,7 @@ namespace DotNetCore.CAP.Kafka
_producerPool
=
new
ConcurrentQueue
<
IProducer
<
string
,
byte
[
]>
>();
_maxSize
=
_options
.
ConnectionPoolSize
;
logger
.
LogDebug
(
"Kafka configuration of CAP :\r\n {0}"
,
Json
Serializer
.
Serialize
(
_options
.
AsKafkaConfig
()));
logger
.
LogDebug
(
"Kafka configuration of CAP :\r\n {0}"
,
Json
Convert
.
SerializeObject
(
_options
.
AsKafkaConfig
()));
}
public
string
ServersAddress
=>
_options
.
Servers
;
...
...
src/DotNetCore.CAP/DotNetCore.CAP.csproj
View file @
02c0eefd
...
...
@@ -13,8 +13,8 @@
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.6.0" />
<PackageReference Include="System.Text.Json" Version="4.6.0" />
</ItemGroup>
</Project>
\ No newline at end of file
src/DotNetCore.CAP/Serialization/ISerializer.JsonUtf8.cs
View file @
02c0eefd
using
System
;
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using
System
;
using
System.Text
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Messages
;
using
System.Tex
t.Json
;
using
Newtonsof
t.Json
;
namespace
DotNetCore.CAP.Serialization
{
...
...
@@ -9,7 +13,8 @@ namespace DotNetCore.CAP.Serialization
{
public
Task
<
TransportMessage
>
SerializeAsync
(
Message
message
)
{
return
Task
.
FromResult
(
new
TransportMessage
(
message
.
Headers
,
JsonSerializer
.
SerializeToUtf8Bytes
(
message
.
Value
)));
var
json
=
JsonConvert
.
SerializeObject
(
message
.
Value
);
return
Task
.
FromResult
(
new
TransportMessage
(
message
.
Headers
,
Encoding
.
UTF8
.
GetBytes
(
json
)));
}
public
Task
<
Message
>
DeserializeAsync
(
TransportMessage
transportMessage
,
Type
valueType
)
...
...
@@ -19,7 +24,8 @@ namespace DotNetCore.CAP.Serialization
return
Task
.
FromResult
(
new
Message
(
transportMessage
.
Headers
,
null
));
}
return
Task
.
FromResult
(
new
Message
(
transportMessage
.
Headers
,
JsonSerializer
.
Deserialize
(
transportMessage
.
Body
,
valueType
)));
var
json
=
Encoding
.
UTF8
.
GetString
(
transportMessage
.
Body
);
return
Task
.
FromResult
(
new
Message
(
transportMessage
.
Headers
,
JsonConvert
.
DeserializeObject
(
json
,
valueType
)));
}
}
}
src/DotNetCore.CAP/Serialization/ISerializer.cs
View file @
02c0eefd
using
System
;
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using
System
;
using
System.Threading.Tasks
;
using
DotNetCore.CAP.Messages
;
using
JetBrains.Annotations
;
...
...
src/DotNetCore.CAP/Serialization/StringSerializer.cs
View file @
02c0eefd
using
DotNetCore.CAP.Messages
;
using
System.Text.Json
;
// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using
DotNetCore.CAP.Messages
;
using
Newtonsoft.Json
;
namespace
DotNetCore.CAP.Serialization
{
...
...
@@ -7,12 +10,12 @@ namespace DotNetCore.CAP.Serialization
{
public
static
string
Serialize
(
Message
message
)
{
return
Json
Serializer
.
Serialize
(
message
);
return
Json
Convert
.
SerializeObject
(
message
);
}
public
static
Message
DeSerialize
(
string
json
)
{
return
Json
Serializer
.
Deserialize
<
Message
>(
json
);
return
Json
Convert
.
DeserializeObject
<
Message
>(
json
);
}
}
}
\ 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