msmq message received more than one time in wcf service - c#

I have a wcf service with msmq binding. WCF service process messages receives from MSMQ queue. I am using transactions in client and wcf both. I am having a issue that even after successful processing of the queue message, the message is not deleting from queue and same messages is again received by the wcf service. So one single message is received more then once and processed.
Please help me why the message is coming more then one time even after successful processing. Is there any settings that I need to done at service side?

Related

Async Return on Sever Message to Client

I have a number of clients that send objects to server1 using Post requests which in turn get sent to server2 using sockets.
Server1 Processes a post requst message from client converts to serverMessage. SeverMessage is sent asynchronously. it listens continuously for response messages that can come in any order but will have their id to identify them.
How do i send a response back to the original thread once Server1 has processed the correct MessageId
If I understood your architecture correctly, You have a gateway or something like a service locator between your client and your business service provider and also the communication between these two servers is async. So you want to send back the procced request from the business service provider to the middle server. If this is your architecture I can recommend two solutions may be been useful:
1. Keep the state in business service provider:
keep the result of any request in some safe place (DB or Memory based on your business) in business service provider and implement a service to accept messageId and send back the result, Then considering to a meaningful period of time in your service broker (server1) you can ask for the result
2. Make a full duplex communication:
You can also provide a service endpoint in server1 and once any process finished in server2 it can send the result for server1 through the endpoint

Send a response from consumer to producer RabbitMQ

I am using RabbitMQ to send data from a server to several consumers. I have to decide when a message will be deleted from the queue so I want to implement that the consumers send a message to the server. If all the consumers send a response then I will remove the message.
I already found an RPC call but I think that is to complex for the problem I have. Is there a faster way to send a quick response to the server? I am using C#.
UPDATE: I think I already found a solution. I will notify the broker so it can be removed from the queue.
You can use prefetch to send multiple messages. The prefetch value is used to specify how many messages that are being sent to the consumer at the same time.
The client can send an ack back to the server, which will delete the message from the broker.

Service bus requiring messages

What is the best way to implement in service bus messages that are requiring once a week or once a day etc.
I am thinking of having a separate windows service that just drops in messages from the database into the service bus but is there another way?
In simple terms i want a message that once it is processed, it will appear again in the queue in a specified amount of time to be processed again.Obviously once i process a message i can tell service bus to delete the message or appear again in the queue.
You will need to have some external process (e.g. your windows service) which sends the message in the first place, on schedule. You can use Azure Scheduler to do that, see http://www.prasadthinks.com/blog/2015/07/11/azure-scheduler-can-post-to-azure-service-bus-queue-and-topic/
When you are processing your message, you can do what you are describing i.e. re-send a copy of the message, using BrokeredMessage.ScheduledEnqueueTimeUtc property so that it arrives at the time you want. But I wouldn't do that, does not feel right. If you have your external processing already sending messages on schedule, just rely on that 100%.

MSMQ stop processing messages from queue

I am using MSMQ in WCF services. I am facing one issue in MSMQ, MSMQ stops processing messages from a queue after some time of intervals. I have to make a request to WCF service(.svc file) to start MSMQ. After requesting svc file MSMQ start processing messages from the queue.
I don't know exactly when MSMQ stop processing but, it stops after some time. Do I want to know why MSMQ goes in idle state? How can I resolve this issue?

.net message queueing

I have a winforms client application that sends messages to an asp.net web service, I need to be able to queue these messages on the client and then then send them in order, waiting for a response from the webservice before sending the next message.
I did look at some examples of queueing using WCF but they seemed to have the queue on the server and not the client.
Any advice abotu what technology to use and on how to implement a solution would be very much appreciated.
Why wait for the response of the server before sending the next message? there is no good reason to do that. Just mark the messages with a sequence number and process them in order at the server.
MSMQ has a queue both on the client and the server and moves the message when a connection is available.
There's also good ol' MSMQ, but that queues things on the server as well.
You could use middleware for the queue (MSMQ etc).
An alternative would be a thread-safe producer/consumer queue at the client. Your "main" code just adds to the queue (ConcurrentQueue in 4.0 might work nicely here, although even in 4.0 I tend to use a utility queue I wrote a while ago instead); and you have a dedicated worker thread that dequeues messages, does the WCF work, and processes the response.
If you need reliable delivery, why not use AMQP with a message broker like RabbitMQ?

Categories