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
a0a824f2
authored
Mar 04, 2022
by
AlexNasyr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IProduser instead of IAnonimusProducer
parent
d0282047
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
DDO_Application/Model/MessageProducer.cs
DDO_Application/Startup.cs
DDO_Application/Model/MessageProducer.cs
View file @
a0a824f2
...
@@ -5,17 +5,15 @@ using System.Threading.Tasks;
...
@@ -5,17 +5,15 @@ using System.Threading.Tasks;
namespace
DDO_Application.Model
{
namespace
DDO_Application.Model
{
public
class
MessageProducer
{
public
class
MessageProducer
{
private
readonly
IAnonymousProducer
_producer
;
private
readonly
IProducer
_producer
;
private
string
_address
;
public
MessageProducer
(
I
AnonymousProducer
producer
,
IConfiguration
configuration
)
{
public
MessageProducer
(
I
Producer
producer
)
{
_producer
=
producer
;
_producer
=
producer
;
_address
=
configuration
.
GetSection
(
"TestQueues"
).
Get
<
configTestQueues
>().
Out
;
}
}
public
async
Task
PublishAsync
<
T
>(
T
message
)
{
public
async
Task
PublishAsync
<
T
>(
T
message
)
{
var
serialized
=
JsonSerializer
.
Serialize
(
message
);
var
serialized
=
JsonSerializer
.
Serialize
(
message
);
var
msg
=
new
Message
(
serialized
);
var
msg
=
new
Message
(
serialized
);
await
_producer
.
SendAsync
(
_address
,
msg
);
await
_producer
.
SendAsync
(
msg
);
}
}
}
}
}
}
\ No newline at end of file
DDO_Application/Startup.cs
View file @
a0a824f2
...
@@ -22,17 +22,18 @@ namespace DDO_Application {
...
@@ -22,17 +22,18 @@ namespace DDO_Application {
public
void
ConfigureServices
(
IServiceCollection
services
)
{
public
void
ConfigureServices
(
IServiceCollection
services
)
{
var
ActiveMQ
=
Configuration
.
GetSection
(
"ActiveMQ"
).
Get
<
configActiveMQ
>().
Endpoint
;
var
ActiveMQ
=
Configuration
.
GetSection
(
"ActiveMQ"
).
Get
<
configActiveMQ
>().
Endpoint
;
var
msgQueues
=
Configuration
.
GetSection
(
"TestQueues"
).
Get
<
configTestQueues
>();
services
.
AddControllers
();
services
.
AddControllers
();
services
.
AddSwaggerGen
(
c
=>
{
c
.
SwaggerDoc
(
"v1"
,
new
OpenApiInfo
{
Title
=
"DDO_Application"
,
Version
=
"v1"
});
});
services
.
AddSwaggerGen
(
c
=>
{
c
.
SwaggerDoc
(
"v1"
,
new
OpenApiInfo
{
Title
=
"DDO_Application"
,
Version
=
"v1"
});
});
services
.
AddHostedService
<
ApiHostedService
>();
services
.
AddHostedService
<
ApiHostedService
>();
services
.
AddSingleton
<
IApiService
,
ApiProcessingService
>();
services
.
AddSingleton
<
IApiService
,
ApiProcessingService
>();
// turn enable ActiveMQ support in project
// turn enable ActiveMQ support in project
services
.
AddActiveMq
(
"ddoApp-cluster"
,
new
[]
{
Endpoint
.
Create
(
host
:
"172.17.100.121"
,
port
:
61616
,
"contingent"
,
"RjQ66VWS"
)
})
//
services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "172.17.100.121", port: 61616, "contingent", "RjQ66VWS") })
//
services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "192.168.2.19", port: 5672, "guest", "guest") })
services
.
AddActiveMq
(
"ddoApp-cluster"
,
new
[]
{
Endpoint
.
Create
(
host
:
"192.168.2.19"
,
port
:
5672
,
"guest"
,
"guest"
)
})
//services.AddActiveMq("ddoApp-cluster", new[] { ActiveMQ })
//services.AddActiveMq("ddoApp-cluster", new[] { ActiveMQ })
.
Add
AnonymousProducer
<
MessageProducer
>(
)
.
Add
Producer
<
MessageProducer
>(
msgQueues
.
Out
)
.
AddTypedConsumer
<
TestMessage
,
MessageCunsomer
>(
Configuration
.
GetSection
(
"TestQueues"
).
Get
<
configTestQueues
>()
.
In
,
RoutingType
.
Multicast
);
.
AddTypedConsumer
<
TestMessage
,
MessageCunsomer
>(
msgQueues
.
In
,
RoutingType
.
Multicast
);
services
.
AddActiveMqHostedService
();
services
.
AddActiveMqHostedService
();
}
}
...
...
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