Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Marat Pavlov
/
AlexAdapter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d09d1666
authored
Apr 04, 2022
by
AlexNasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xml tested
parent
79f0f267
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
SocialMinistryDataExchange/Controllers/apiController.cs
SocialMinistryDataExchange/Model/SmMessageProdusers.cs
SocialMinistryDataExchange/Controllers/apiController.cs
View file @
d09d1666
...
@@ -16,7 +16,7 @@ namespace SocialMinistryDataExchange.Controllers {
...
@@ -16,7 +16,7 @@ namespace SocialMinistryDataExchange.Controllers {
_messageProducer
=
messageProducer
;
_messageProducer
=
messageProducer
;
}
}
//тестовый запрос для симуляции получения XML запроса
//тестовый запрос для симуляции получения XML запроса
(берется из файла)
[
HttpGet
]
[
HttpGet
]
[
Route
(
"[controller]/putXMLDefenceStatus"
)]
[
Route
(
"[controller]/putXMLDefenceStatus"
)]
public
async
Task
<
string
>
PutXMLDefenceStatus
()
{
public
async
Task
<
string
>
PutXMLDefenceStatus
()
{
...
@@ -25,12 +25,13 @@ namespace SocialMinistryDataExchange.Controllers {
...
@@ -25,12 +25,13 @@ namespace SocialMinistryDataExchange.Controllers {
return
responce
;
return
responce
;
}
}
//тестовый запрос для
симуляции получения XML запроса
//тестовый запрос для
отправки XML запроса во входящую очередь (типа они отправили)
[
HttpGet
]
[
HttpGet
]
[
Route
(
"[controller]/putXMLToActiveMQServer"
)]
[
Route
(
"[controller]/putXMLToActiveMQServer"
)]
public
async
Task
<
IActionResult
>
PutXMLToAMQ
()
{
public
async
Task
<
IActionResult
>
PutXMLToAMQ
()
{
var
request
=
System
.
IO
.
File
.
ReadAllText
(
"Model/reference/Request.xml"
);
var
request
=
System
.
IO
.
File
.
ReadAllText
(
"Model/reference/Request.xml"
);
await
_messageProducer
.
PublishAsync
(
request
);
await
_messageProducer
.
PublishAsync
(
request
);
return
StatusCode
((
int
)
HttpStatusCode
.
Created
,
null
);
return
StatusCode
((
int
)
HttpStatusCode
.
Created
,
null
);
}
}
...
...
SocialMinistryDataExchange/Model/SmMessageProdusers.cs
View file @
d09d1666
using
ActiveMQ.Artemis.Client
;
using
ActiveMQ.Artemis.Client
;
using
SocialMinistryDataExchange.Model.EscpSD
;
using
System
;
using
System
;
using
System.IO
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Xml.Serialization
;
namespace
SocialMinistryDataExchange.Model
{
namespace
SocialMinistryDataExchange.Model
{
public
class
MessageProducer
{
public
class
MessageProducer
{
...
@@ -13,15 +10,7 @@ namespace SocialMinistryDataExchange.Model {
...
@@ -13,15 +10,7 @@ namespace SocialMinistryDataExchange.Model {
_producer
=
producer
;
_producer
=
producer
;
}
}
public
async
Task
PublishAsync
<
T
>(
T
message
)
{
public
async
Task
PublishAsync
<
T
>(
T
message
)
{
XmlSerializer
xmlSerializer
=
new
(
typeof
(
EcspSendingStatusMaloimushch
));
var
msg
=
new
Message
(
message
);
string
serialized
=
message
.
ToString
();
//string serialized = string.Empty;
//using (StringWriter writer = new()) {
// xmlSerializer.Serialize(writer, message);
// serialized = writer.ToString();
//}
var
msg
=
new
Message
(
serialized
);
try
{
try
{
await
_producer
.
SendAsync
(
msg
);
await
_producer
.
SendAsync
(
msg
);
...
...
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